Courses

How to Structure Databases in Laravel

ENUMS, Foreign Keys, or Just String?

Previous: JSON DB Fields: Yay or Nay?
avatar

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.

👍 4
avatar
You can use Markdown
avatar

UPDATE: https://www.youtube.com/watch?v=uEBHJVK-Ibg&ab_channel=LaravelDaily

watch this

avatar
You can use Markdown
avatar
You can use Markdown