-
-
Notifications
You must be signed in to change notification settings - Fork 106
Expand file tree
/
Copy pathViewLicense.php
More file actions
46 lines (41 loc) · 1.57 KB
/
Copy pathViewLicense.php
File metadata and controls
46 lines (41 loc) · 1.57 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
<?php
namespace App\Filament\Resources\LicenseResource\Pages;
use App\Actions\Licenses\SuspendLicense;
use App\Filament\Resources\LicenseResource;
use App\Models\License;
use Filament\Actions;
use Filament\Notifications\Notification;
use Filament\Resources\Pages\ViewRecord;
/**
* @property ?License $record
*/
class ViewLicense extends ViewRecord
{
protected static string $resource = LicenseResource::class;
protected function getHeaderActions(): array
{
return [
Actions\ActionGroup::make([
Actions\Action::make('suspend')
->label('Suspend License')
->icon('heroicon-o-archive-box-x-mark')
->color('danger')
->requiresConfirmation()
->modalHeading('Suspend License')
->modalDescription('Are you sure you want to suspend this license? This will prevent the user from using the software.')
->modalSubmitActionLabel('Yes, suspend license')
->visible(fn () => ! $this->record->is_suspended)
->action(function () {
app(SuspendLicense::class)->handle($this->record);
Notification::make()
->title('License suspended successfully')
->success()
->send();
}),
Actions\DeleteAction::make(),
])
->label('Actions')
->icon('heroicon-m-ellipsis-vertical'),
];
}
}