components([ TextInput::make('name') ->label('Nama') ->placeholder('Pelaporan') ->autocomplete(false) ->autofocus() ->required() ->maxLength(50), ]) ->columns(1); } public static function table(Table $table): Table { return $table ->columns([ TextColumn::make('name') ->label('Nama') ->searchable() ->sortable(), ToggleColumn::make('is_active') ->label('Aktif?') ->sortable() ->getStateUsing(fn (Classification $record): bool => $record->is_active === IsActive::ACTIVE) ->updateStateUsing(function (Classification $record, bool $state): void { $record->is_active = $state ? IsActive::ACTIVE : IsActive::INACTIVE; $record->save(); CheerfulNotification::statusUpdated()->send(); }), ...TimestampColumns::make(), ]) ->filters([ TrashedFilter::make() ->native(false) ->visible(fn () => auth()->user()?->hasRole(RoleEnum::DEVELOPER->value)), ]) ->recordActions([ EditAction::make() ->modalWidth(Width::Large), DeleteAction::make(), ForceDeleteAction::make(), RestoreAction::make(), ]) ->toolbarActions([ BulkActionGroup::make([ ...DefaultBulkActions::make('klasifikasi'), ]), ]) ->emptyStateIcon(Heroicon::BookOpen) ->emptyStateDescription('Setelah Anda membubat data 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, ]); } }