Want to access all of our courses? (30 h 09 min)
You also get:
Already a member? Login here
Now that PHP (>= 8.1) supports enums natively and Laravel has native enum type casting this has become so much easier to deal with. Just create the enum you want (has to be "backed") and use it in a model cast.
Eloquent mutators - Enum Casting, in the Laravel docs.
UPDATE: https://www.youtube.com/watch?v=uEBHJVK-Ibg&ab_channel=LaravelDaily
watch this
Tell us what you like or what we can improve
Feel free to share anything you like or dislike about this page or the platform in general.
Your feedback has been received. We truly appreciate you taking the time to help us improve.
Now that PHP (>= 8.1) supports enums natively and Laravel has native enum type casting this has become so much easier to deal with. Just create the enum you want (has to be "backed") and use it in a model cast.
Eloquent mutators - Enum Casting, in the Laravel docs.