authorize('update', $this->project); } public function getWidgets(): array { return [ [ UpdateProject::class, ['project' => $this->project], ], [ AddUser::class, ['project' => $this->project], ], [ ProjectUsersList::class, ['project' => $this->project], ], ]; } public function getTitle(): string|Htmlable { return 'Project Settings'; } protected function getHeaderActions(): array { return [ Action::make('delete') ->record($this->project) ->color('danger') ->label('Delete Project') ->icon('heroicon-o-trash') ->modalHeading('Delete Project') ->modalDescription('Are you sure you want to delete this project? This action will delete all associated data and cannot be undone.') ->requiresConfirmation() ->action(function (Project $record) { try { app(DeleteProject::class)->delete(auth()->user(), $record); Notification::make() ->success() ->title('Project deleted successfully.') ->send(); $this->redirect(Index::getUrl()); } catch (Exception $e) { Notification::make() ->title($e->getMessage()) ->danger() ->send(); } }), ]; } }