components([ Section::make() ->schema([ Select::make('user_id') ->relationship('user', 'username') ->required() ->searchable() ->label('Gebruiker'), Textarea::make('message') ->required() ->columnSpanFull() ->label('Bericht'), ]), ]); } #[\Override] public static function table(Table $table): Table { return $table ->defaultSort('id', 'desc') ->columns([ TextColumn::make('id') ->label('ID'), TextColumn::make('user.username') ->label('Gebruiker'), TextColumn::make('message') ->label('Bericht') ->limit(50), IconColumn::make('reported') ->label('Gerapporteerd') ->boolean() ->trueIcon('heroicon-o-flag') ->falseIcon('heroicon-o-check') ->trueColor('danger') ->falseColor('success'), TextColumn::make('created_at') ->dateTime() ->sortable() ->label('Aangemaakt'), ]) ->filters([ // ]) ->recordActions([ Action::make('report') ->label('Melden') ->icon('heroicon-o-flag') ->color('danger') ->requiresConfirmation() ->action(function (RadioShout $record) { $record->update([ 'reported' => true, 'reported_by' => auth()->id(), ]); }) ->hidden(fn (RadioShout $record) => $record->reported), Action::make('unreport') ->label('Melding intrekken') ->icon('heroicon-o-check') ->color('success') ->requiresConfirmation() ->action(function (RadioShout $record) { $record->update([ 'reported' => false, 'reported_by' => null, ]); }) ->visible(fn (RadioShout $record) => $record->reported), DeleteAction::make(), ]) ->headerActions([]); } #[\Override] public static function getRelations(): array { return [ // ]; } #[\Override] public static function getPages(): array { return [ 'index' => ListRadioShouts::route('/'), ]; } }