Finally, the support for Php Enums has been added in the PHP version But as enums are new in php, we do not have some helpers to work with that easily. So with this amazing Laravel Enum Pro package, you have pretty more options for working with enums than built-in methods.

enum LevelTypes: int { use \Lazerg\LaravelEnumPro\EnumPro; case VERY_EASY = case EASY = case MEDIUM = case STRONG = }

As you can see, names here VERY_EASY, EASY, MEDIUM, STRONG, VERY_STRONG.

you can use these helper methods: LevelTypes::names(); // Collection: ['VERY_EASY', 'EASY', 'MEDIUM', 'STRONG', 'VERY_STRONG'] LevelTypes::namesToArray(); // Array: ['VERY_EASY', 'EASY', 'MEDIUM', 'STRONG', 'VERY_STRONG'] LevelTypes::namesToString(); // String: VERY_EASY, EASY, MEDIUM, STRONG, VERY_STRONG
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge. Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge.
Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Shirts painstakingly handcrafted by under-caffeinated developers. Shirts painstakingly handcrafted by under-caffeinated developers.
Community Partners