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