Danny
Deleting a tenant with EditTeamProfile.php
Got it! If anyone else is hitting their head with this. Here's how I solved it:
protected function getHeaderActions(): array
{
$user = auth()->user();
if ($this->tenant->id != $user->team_id) {
return [
Actions\Action::make('Delete location')
->name('delete')
->icon('heroicon-m-x-mark')
->color('danger')
->requiresConfirmation()
->action(function (Team $team) {
$this->tenant->delete();
redirect(route('filament.dashboard.pages.dashboard', [
'tenant' => auth()->user()->team_id
]));
Notification::make()
->success()
->title('Location deleted')
->body('The location has been deleted.')
->send();
}),
];
} else {
return [];
}
}
4 replies