forked from alexjustesen/speedtest-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDeleteData.php
More file actions
49 lines (38 loc) · 1.4 KB
/
DeleteData.php
File metadata and controls
49 lines (38 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
namespace App\Filament\Pages;
use App\Jobs\DeleteResultsData;
use Filament\Notifications\Notification;
use Filament\Pages\Actions\Action;
use Filament\Pages\Page;
class DeleteData extends Page
{
protected static ?string $navigationGroup = 'System';
protected static ?string $navigationIcon = 'heroicon-o-trash';
protected static ?int $navigationSort = 2;
protected static ?string $slug = 'system/delete-data';
protected static string $view = 'filament.pages.delete-data';
protected ?string $maxContentWidth = '3xl';
public function getActions(): array
{
return [
Action::make('delete')
->color('danger')
->icon('heroicon-o-trash')
->action(fn () => $this->deleteData())
->requiresConfirmation()
->modalHeading('Confirmation')
->modalSubheading('Are you really-really-really sure you want to do this?')
->modalContent(view('filament.pages.modals.delete-results-data-confirmation'))
->modalButton('Yes, I\'m sure'),
];
}
protected function deleteData()
{
DeleteResultsData::dispatch();
Notification::make()
->title('Deleting speedtest results data')
->body('The job has been added to the queue and will be completed shortly.')
->warning()
->send();
}
}