columns(3) ->components([ Section::make('Details') ->columnSpan(2) ->components([ TextInput::make('name') ->required() ->live(onBlur: true) ->afterStateUpdated(function (string $operation, $state, callable $set) { if ($operation === 'create') { $set('slug', Str::slug($state)); } }), TextInput::make('slug') ->required() ->unique(Tool::class, 'slug', ignoreRecord: true) ->helperText('Used in the URL, e.g. /tools/your-slug'), Textarea::make('description') ->required() ->rows(4) ->columnSpanFull(), TextInput::make('url') ->label('Website URL') ->url() ->required(), TextInput::make('logo_url') ->label('Logo URL') ->url(), TagsInput::make('tags') ->placeholder('Add a tag and press enter') ->helperText('e.g. free, api, open-source') ->columnSpanFull(), TagsInput::make('features') ->placeholder('Add a feature and press enter') ->columnSpanFull(), ]), Section::make('Classification') ->columnSpan(1) ->components([ Select::make('category') ->options(config('tools.categories')) ->required() ->searchable(), TextInput::make('subcategory') ->helperText('e.g. Code Assistants'), TextInput::make('pricing') ->helperText('e.g. Free, Freemium, $10/month'), ]), Section::make('Moderation') ->columnSpan(3) ->columns(4) ->components([ Toggle::make('approved') ->helperText('Only approved tools are shown publicly.') ->default(false), Toggle::make('featured') ->helperText('Highlight this tool.') ->default(false), Select::make('user_id') ->label('Submitted by') ->relationship('user', 'name') ->searchable() ->preload(), TextInput::make('views') ->numeric() ->default(0) ->disabled() ->dehydrated(), TextInput::make('clicks') ->numeric() ->default(0) ->disabled() ->dehydrated(), ]), ]); } }