44 lines
1.1 KiB
PHP
44 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Resources\BackupSetResource\Pages;
|
|
|
|
use App\Filament\Resources\BackupSetResource;
|
|
use App\Support\Auth\Capabilities;
|
|
use App\Support\Rbac\UiEnforcement;
|
|
use Filament\Actions;
|
|
use Filament\Resources\Pages\ListRecords;
|
|
|
|
class ListBackupSets extends ListRecords
|
|
{
|
|
protected static string $resource = BackupSetResource::class;
|
|
|
|
private function tableHasRecords(): bool
|
|
{
|
|
return $this->getTableRecords()->count() > 0;
|
|
}
|
|
|
|
protected function getHeaderActions(): array
|
|
{
|
|
$create = Actions\CreateAction::make();
|
|
UiEnforcement::forAction($create)
|
|
->requireCapability(Capabilities::TENANT_SYNC)
|
|
->apply();
|
|
|
|
return [
|
|
$create->visible(fn (): bool => $this->tableHasRecords()),
|
|
];
|
|
}
|
|
|
|
protected function getTableEmptyStateActions(): array
|
|
{
|
|
$create = Actions\CreateAction::make();
|
|
UiEnforcement::forAction($create)
|
|
->requireCapability(Capabilities::TENANT_SYNC)
|
|
->apply();
|
|
|
|
return [
|
|
$create,
|
|
];
|
|
}
|
|
}
|