Carbon::hasFormat($date, 'Y-m-d') ) ); $this->selectedDates = $params['selectedDates']; // Re-render the agenda's table with dates filter applied $this->resetTable(); } public function isReadOnly(): bool { return false; } public function form(Schema $schema): Schema { return AgendaForm::configure($schema); } public function table(Table $table): Table { $agendasTable = AgendasTable::configure($table) ->headerActions([ CreateAction::make() ->label('Add agenda item') ->modalHeading('Add agenda item') ->modalSubmitActionLabel('Save') ->disableCreateAnother() ->icon(Heroicon::OutlinedPlus) ->successNotification(fn (): Notification => Notification::make() ->title('Agenda item added') ->body('New agenda item has been succesfully added to the audit.') ->success() ) ->after(function (): void { $this->dispatch( 'agendas-updated', [ 'eventName' => 'agendas-updated', ], ); }), ]) ->recordActions([ ViewAction::make() ->label('Start') ->color('primary') ->icon(Heroicon::Play) ->url(fn (Agenda $agenda): string => AgendaResource::getUrl('view', ['record' => $agenda])), EditAction::make() ->modalSubmitActionLabel('Save') ->successNotification(fn (): Notification => Notification::make() ->title('Audit updated') ->body('Audit has been updated.') ->success() ) ->after(function (): void { $this->dispatch( 'agendas-updated', [ 'eventName' => 'agendas-updated', ], ); }), DeleteAction::make(), ]); if (empty($this->selectedDates)) { return $agendasTable; } $agendasTable ->modifyQueryUsing(fn (Builder $query): Builder => $query->whereIn(DB::raw('DATE(agendas.date_from)'), $this->selectedDates) ) ->emptyStateDescription(function (): string { $count = count($this->selectedDates); $suffix = $count > 1 ? 'these dates' : 'this date'; return "No agendas found for {$suffix}."; }); return $agendasTable; } }