Skip to main content

ENUMS, Foreign Keys, or Just String?

Premium
8:00

The Full Lesson is Only for Premium Members

Want to access all of our courses? (30 h 09 min)

You also get:

55 courses
Premium tutorials
Access to repositories
Private Discord
Get Premium for $129/year or $29/month

Already a member? Login here

Comments & Discussion

P
pascual ✓ Link copied!

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.

We'd Love Your Feedback

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.