Inherits from Select.
* has the same capabilities.
Operates the same as the Select field but accepts Enum as options.
    use MoonShine\UI\Fields\Enum;
Enum::make('Status')
    ->attach(StatusEnum::class)
    
    use MoonShine\UI\Fields\Enum;
 
Enum::make('Status')
    ->attach(StatusEnum::class)
use MoonShine\UI\Fields\Enum;
Enum::make('Status')
    ->attach(StatusEnum::class)
use MoonShine\UI\Fields\Enum;
 
Enum::make('Status')
    ->attach(StatusEnum::class)
use MoonShine\UI\Fields\Enum;
Enum::make('Status')
    ->attach(StatusEnum::class)
 
    
    
        
The model attributes require Enum Cast.
     
 
toString
The toString() method implemented in Enum allows you to set the displayed value.
    namespace App\Enums;
enum StatusEnum: string
{
    case NEW = 'new';
    case DRAFT = 'draft';
    case PUBLIC = 'public';
    public function toString(): ?string
    {
        return match ($this) {
            self::NEW => 'New',
            self::DRAFT => 'Draft',
            self::PUBLIC => 'Public',
        };
    }
}
    
    namespace App\Enums;
 
enum StatusEnum: string
{
    case NEW = 'new';
    case DRAFT = 'draft';
    case PUBLIC = 'public';
 
    public function toString(): ?string
    {
        return match ($this) {
            self::NEW => 'New',
            self::DRAFT => 'Draft',
            self::PUBLIC => 'Public',
        };
    }
}
namespace App\Enums;
enum StatusEnum: string
{
    case NEW = 'new';
    case DRAFT = 'draft';
    case PUBLIC = 'public';
    public function toString(): ?string
    {
        return match ($this) {
            self::NEW => 'New',
            self::DRAFT => 'Draft',
            self::PUBLIC => 'Public',
        };
    }
}
namespace App\Enums;
 
enum StatusEnum: string
{
    case NEW = 'new';
    case DRAFT = 'draft';
    case PUBLIC = 'public';
 
    public function toString(): ?string
    {
        return match ($this) {
            self::NEW => 'New',
            self::DRAFT => 'Draft',
            self::PUBLIC => 'Public',
        };
    }
}
namespace App\Enums;
enum StatusEnum: string
{
    case NEW = 'new';
    case DRAFT = 'draft';
    case PUBLIC = 'public';
    public function toString(): ?string
    {
        return match ($this) {
            self::NEW => 'New',
            self::DRAFT => 'Draft',
            self::PUBLIC => 'Public',
        };
    }
}
 
If Enum implements the getColor() method, the field in "preview" mode will be displayed as an icon of a specific color.
Available colors:
primary
secondary
success
warning
error
info
purple
pink
blue
green
yellow
red
gray
    namespace App\Enums;
enum StatusEnum: string
{
    case NEW = 'new';
    case DRAFT = 'draft';
    case PUBLIC = 'public';
    public function getColor(): ?string
    {
        return match ($this) {
            self::NEW => 'info',
            self::DRAFT => 'gray',
            self::PUBLIC => 'success',
        };
    }
}
    
    namespace App\Enums;
 
enum StatusEnum: string
{
    case NEW = 'new';
    case DRAFT = 'draft';
    case PUBLIC = 'public';
 
    public function getColor(): ?string
    {
        return match ($this) {
            self::NEW => 'info',
            self::DRAFT => 'gray',
            self::PUBLIC => 'success',
        };
    }
}
namespace App\Enums;
enum StatusEnum: string
{
    case NEW = 'new';
    case DRAFT = 'draft';
    case PUBLIC = 'public';
    public function getColor(): ?string
    {
        return match ($this) {
            self::NEW => 'info',
            self::DRAFT => 'gray',
            self::PUBLIC => 'success',
        };
    }
}
namespace App\Enums;
 
enum StatusEnum: string
{
    case NEW = 'new';
    case DRAFT = 'draft';
    case PUBLIC = 'public';
 
    public function getColor(): ?string
    {
        return match ($this) {
            self::NEW => 'info',
            self::DRAFT => 'gray',
            self::PUBLIC => 'success',
        };
    }
}
namespace App\Enums;
enum StatusEnum: string
{
    case NEW = 'new';
    case DRAFT = 'draft';
    case PUBLIC = 'public';
    public function getColor(): ?string
    {
        return match ($this) {
            self::NEW => 'info',
            self::DRAFT => 'gray',
            self::PUBLIC => 'success',
        };
    }
}
 
