PHP 8.1 enums can be used as model casts

PHP 8.1 enums can be used as model casts

🔥 Did you know that @laravelphp can cast model columns into instances an enum in PHP 8.1?

The example below will create an instance of OrderStatus based on variant value. If the status column has the value shipped, it will return the OrderStatus::Shipped variant.

We're writing a book, you can get it for free here.