schema([ Forms\Components\Section::make()->schema([ Forms\Components\Grid::make('2')->schema([ TextInput::make('title')->label('Заголовок')->required() ->live(onBlur: true) ->afterStateUpdated(function (string $operation, string|null $state, Forms\Set $set) { $set('slug', Str::slug($state)); $set('seo.title', $state); }), TextInput::make('slug')->label('Slug')->unique(ignoreRecord: true)->readOnly()->required(), Forms\Components\Select::make('dir_addit_educat_id')->required()->label('Направление доп. образования') ->preload() ->options(DirectionAdditionalEducation::where('is_active', true)->pluck('title', 'id')) ]), Forms\Components\Toggle::make('is_active')->label('Активно')->columnSpanFull()->inline(false)->default(true), ]), ]); } public static function table(Table $table): Table { return $table ->columns([ TextColumn::make('id')->label('ID')->sortable(), TextColumn::make('title')->label('Название')->sortable()->searchable(), TextColumn::make('created_at')->label('Дата создания')->sortable(), Tables\Columns\BadgeColumn::make('direction.title')->label('Направление')->sortable(), Tables\Columns\ToggleColumn::make('is_active')->label('Активно')->sortable(), ]) ->filters([ // ]) ->actions([ Tables\Actions\EditAction::make(), ]) ->bulkActions([ Tables\Actions\BulkActionGroup::make([ Tables\Actions\DeleteBulkAction::make(), ]), ]); } public static function getRelations(): array { return [ // ]; } public static function getPages(): array { return [ 'index' => Pages\ListAdditionalEducationCategories::route('/'), 'create' => Pages\CreateAdditionalEducationCategory::route('/create'), 'edit' => Pages\EditAdditionalEducationCategory::route('/{record}/edit'), ]; } }