g4t/enum is a Laravel package for php enums.
It currently has 0 GitHub stars and 5 downloads on Packagist (latest version 0.0.1).
Install it with composer require g4t/enum.
Discover more Laravel packages by g4t
or browse all Laravel packages to compare alternatives.
Last updated
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.