This package offers strongly typed enums in PHP. In this package we will change the value coming from the database and entered into it
Via Composer
composer require g4t/enum
php artisan vendor:publish --provider=g4t\Enum\EnumServiceProvider
use the following code in model
use g4t\Enum\Status;
.
.
.
protected $casts = [
'column_name' => Status::class,
];
now go to config/enum.php
you well find this example there:
<?php
return [
'1' => 'active',
'2' => 'inactive'
];
MIT. Please see the license file for more information.