components([ TextInput::make('name') ->label('Nama') ->placeholder('Pelaporan') ->autocomplete(false) ->autofocus() ->required() ->maxLength(50), RichEditor::make('description') ->label('Keterangan') ->placeholder('Silakan isi keterangan klasifikasi di atas') ->nullable(), ]) ->columns(1); } public static function table(Table $table): Table { return $table ->recordTitleAttribute('name') ->columns([ TextColumn::make('name') ->label('Nama') ->searchable() ->sortable(), ToggleColumn::make('is_active') ->label('Aktif?') ->getStateUsing(fn (Classification $record) => $record->is_active === IsActive::ACTIVE) ->updateStateUsing(function (Classification $record, bool $state) { $record->is_active = $state ? IsActive::ACTIVE : IsActive::INACTIVE; $record->save(); }) ->sortable(), ...TimestampColumns::make(), ]) ->filters([ TrashedFilter::make()->native(false), ]) ->recordActions([ EditAction::make()->modalWidth('lg'), DeleteAction::make(), ForceDeleteAction::make(), RestoreAction::make(), ]) ->toolbarActions([ BulkActionGroup::make([ DeleteBulkAction::make(), ForceDeleteBulkAction::make(), RestoreBulkAction::make(), ]), ]) ->emptyStateIcon('heroicon-o-bookmark') ->emptyStateDescription('Setelah Anda menulis posting pertama, maka akan muncul disini.') ->defaultSort('created_at', 'desc') ->deferFilters(false) ->reorderable('sort_order'); } public static function getPages(): array { return [ 'index' => ManageClassifications::route('/'), ]; } public static function getRecordRouteBindingEloquentQuery(): Builder { return parent::getRecordRouteBindingEloquentQuery() ->withoutGlobalScopes([ SoftDeletingScope::class, ]); } }