-
composer.json
Open in GitHub{ // "require": { // "spatie/laravel-enum": "^2.5", } // }
-
app/Models/Enums/TechnologyType.php
Open in GitHubuse Spatie\Enum\Laravel\Enum; class TechnologyType extends Enum { public static function toLabels(): array { return [ 'frontend'=> 'Frontend', 'backend' => 'Backend', 'devops' => 'Devops', 'tools' => 'Tools', 'integrations' => 'Integrations', ]; } }
-
app/Models/Technology.php
Open in GitHubuse Illuminate\Database\Eloquent\Model; class Technology extends Model { // public $casts = [ 'type' => TechnologyType::class.':nullable', 'recommended_by' => 'array', ]; // }
-
app/Nova/Technology.php
Open in GitHubuse Laravel\Nova\Fields\Select; class Technology extends Resource { // public function fields(Request $request): array { return [ // Select::make('Type') ->sortable() ->nullable(false) ->rules(['required']) ->options(TechnologyType::toLabels()), // ]; } }