- require composer kwaadpepper/enum - User->role is now an enum - Add isLocal and isAdmin to user model - changed multiple fields casts on model Settings - added validation for settings
41 lines
742 B
PHP
41 lines
742 B
PHP
<?php
|
|
|
|
namespace App\Enums;
|
|
|
|
use Kwaadpepper\Enum\BaseEnumRoutable;
|
|
|
|
/**
|
|
* @method static self admin()
|
|
* @method static self brand()
|
|
* @method static self customer()
|
|
*/
|
|
final class UserRole extends BaseEnumRoutable
|
|
{
|
|
/**
|
|
* Enum values
|
|
*
|
|
* @return array
|
|
*/
|
|
protected static function values(): array
|
|
{
|
|
return [
|
|
'admin' => 0,
|
|
'brand' => 1,
|
|
'customer' => 2
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Enum labels
|
|
*
|
|
* @return array
|
|
*/
|
|
protected static function labels(): array
|
|
{
|
|
return [
|
|
'admin' => trans('enums.admin'),
|
|
'brand' => trans('enums.brand'),
|
|
'customer' => trans('enums.customer')
|
|
];
|
|
}
|
|
}
|