-
composer.json
Open in GitHub{ // "require": { "php": "^8.0", // "spatie/laravel-enum": "^2.4" }, // }
-
app/Enums/BlockReason.php
Open in GitHubuse Closure; use Illuminate\Support\Str; final class BlockReason extends Enum { protected static function labels(): Closure { return fn (string $value): string => Str::of($value)->replace('_', ' ')->title(); } }
-
app/Filament/Resources/OrganizationResource.php
Open in GitHubuse App\Enums\BlockReason as BlockReasonEnum; use Filament\Resources\Forms\Components\Select; use Filament\Resources\Forms\Components\TextInput; class OrganizationResource extends Resource { // public static function form(Form $form): Form { return $form ->schema([ TextInput::make('id')->disabled(), TextInput::make('name')->disabled(), TextInput::make('full_name')->disabled(), TextInput::make('description')->disabled(), TextInput::make('location')->disabled(), TextInput::make('twitter')->disabled(), TextInput::make('website')->disabled(), Select::make('block_reason') ->options(Arr::prepend(BlockReasonEnum::toArray(), '—', null)) ->nullable(), TextInput::make('blocked_at')->disabled(), ]); } // }