Download the PHP package sakanjo/laravel-easy-enum without Composer
On this page you can find all versions of the php package sakanjo/laravel-easy-enum. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download sakanjo/laravel-easy-enum
More information about sakanjo/laravel-easy-enum
Files in sakanjo/laravel-easy-enum
Informations about the package laravel-easy-enum
đĨ Easy enum
Easily work with enums.
⨠Help support the maintenance of this package by sponsoring me.
Designed to work with Laravel, Filament, and more.
Table of Contents
- Install
- Usage
- 1. Create enum
- 2. Create lang file
- Methods
- getLabel
- is
- isNot
- tryFromName
- fromName
- names
- values
- options
- toHtml
- resolveDisplayableValue
- Practical examples
- Filamentphp
- Enum
- Resource
- Laravel blade
- Filamentphp
- Support the development
- Credits
- License
đĻ Install
đĻ Usage
1. Create enum
2. Create lang file
That's it!
đ Methods
getLabel
Returns the label of the enum value.
is
Checks if the enum is equal to another one.
isNot
inverse of is
.
in
Checks if the enum is in a list of enums.
notIn
inverse of in
.
tryFromName
Safely converts a string to its corresponding enum value (returns null if not found).
Converts a string to its corresponding enum value (throws exception if not found).
fromName
names
Returns a list of case names.
values
Returns a list of case values .
options
Returns an associative array of case names and values.
toHtml
alias for getLabel
, useful in blade.
resolveDisplayableValue
same as toHtml
except it doesn't render HTML.
đĨ Practical examples
Filamentphp
Enum
Resource
Laravel blade
đ Support the development
Do you like this project? Support it by donating
Click the "đ Sponsor" at the top of this repo.
Šī¸ Credits
- Salah Kanjo
- All Contributors
đ License
MIT License Š 2023-PRESENT Salah Kanjo