{
//
"require": {
"php": "^8.0",
//
"spatie/laravel-enum": "^2.4"
},
//
}
use 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();
}
}
use 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(),
]);
}
//
}
Additional resources on enum:
-
Povilas Korop | www.youtube.com
Published on
-
Povilas Korop | www.youtube.com
Published on