lopatin96 / lara-enum
Installs: 134
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/lopatin96/lara-enum
Requires
- php: >=8.4
Requires (Dev)
- orchestra/testbench: ^10.0
This package is auto-updated.
Last update: 2025-09-22 18:19:01 UTC
README
Installation
You can install this package via composer:
composer require lopatin96/lara-enum
How to use
Publish config and local files:
php artisan vendor:publish --tag="lara-enum-config"
php artisan vendor:publish --tag="lara-enum-lang"
Config
Add key-value to lara-enum config file:
return [ 'document-status' => [ 'color' => [ 'pending' => 'amber', 'in_progress' => 'blue', 'in_progress_pending' => 'blue', 'finished' => 'green', 'error' => 'red', ], ], ];
and call $document->status->getColorProperty()
.
Local
Add key-value to lara-enum local file:
return [ 'document-status' => [ 'label' => [ 'pending' => 'Pending', 'in_progress' => 'In progress', 'in_progress_pending' => 'In progress', 'finished' => 'Finished', 'error' => 'Error', ], ], ];
and call $document->status->getLabelLocal()
.