feat: Permission System Hướng B - Models, Command, User can(), session cache

This commit is contained in:
2026-04-29 08:25:37 +00:00
parent d2df9edd69
commit 40b75fcf75
15 changed files with 354 additions and 0 deletions

View File

@@ -13,6 +13,7 @@ use App\Filament\Resources\Appendices\Tables\AppendicesTable;
class AppendixResource extends Resource
{
protected static array $permissionActions = ["view", "create", "update", "delete", "restore", "forceDelete"];
protected static ?string $model = Appendix::class;
protected static string | \BackedEnum | null $navigationIcon = 'heroicon-o-document-text';
protected static string | \UnitEnum | null $navigationGroup = NavigationGroup::TRANSACTION->value;

View File

@@ -14,6 +14,7 @@ use App\Filament\Resources\Contracts\Tables\ContractsTable;
class ContractResource extends Resource
{
protected static array $permissionActions = ["view", "create", "update", "delete", "restore", "forceDelete"];
protected static ?string $model = Contract::class;
protected static string | \BackedEnum | null $navigationIcon = 'heroicon-o-document-text';
protected static string | \UnitEnum | null $navigationGroup = NavigationGroup::TRANSACTION->value;

View File

@@ -13,6 +13,7 @@ use App\Filament\Resources\Customers\Tables\CustomersTable;
class CustomerResource extends Resource
{
protected static array $permissionActions = ["view", "create", "update", "delete", "restore", "forceDelete"];
protected static ?string $model = Customer::class;
protected static string | \BackedEnum | null $navigationIcon = 'heroicon-o-users';
protected static string | \UnitEnum | null $navigationGroup = NavigationGroup::CUSTOMER->value;

View File

@@ -13,6 +13,7 @@ use App\Filament\Resources\FormTemplates\Tables\FormTemplatesTable;
class FormTemplateResource extends Resource
{
protected static array $permissionActions = ["view", "create", "update", "delete", "restore", "forceDelete"];
protected static ?string $model = FormTemplate::class;
protected static string | \BackedEnum | null $navigationIcon = 'heroicon-o-document-duplicate';
protected static string | \UnitEnum | null $navigationGroup = NavigationGroup::SETTING->value;

View File

@@ -13,6 +13,7 @@ use App\Filament\Resources\PaymentFines\Tables\PaymentFinesTable;
class PaymentFineResource extends Resource
{
protected static array $permissionActions = ["view", "create", "update", "delete", "restore", "forceDelete"];
protected static ?string $model = PaymentFine::class;
protected static string | \BackedEnum | null $navigationIcon = 'heroicon-o-exclamation-triangle';
protected static string | \UnitEnum | null $navigationGroup = NavigationGroup::FINANCE->value;

View File

@@ -13,6 +13,7 @@ use App\Filament\Resources\Payments\Tables\PaymentsTable;
class PaymentResource extends Resource
{
protected static array $permissionActions = ["view", "create", "update", "delete", "restore", "forceDelete"];
protected static ?string $model = Payment::class;
protected static string | \BackedEnum | null $navigationIcon = 'heroicon-o-banknotes';
protected static string | \UnitEnum | null $navigationGroup = NavigationGroup::FINANCE->value;

View File

@@ -14,6 +14,7 @@ use App\Filament\Resources\Products\Schemas\ProductForm;
class ProductResource extends Resource
{
protected static array $permissionActions = ["view", "create", "update", "delete", "restore", "forceDelete"];
protected static ?string $model = Product::class;
protected static string | \BackedEnum | null $navigationIcon = 'heroicon-o-squares-2x2';
protected static string | \UnitEnum | null $navigationGroup = NavigationGroup::WAREHOUSE->value;

View File

@@ -13,6 +13,7 @@ use App\Filament\Resources\Projects\Schemas\ProjectForm;
class ProjectResource extends Resource
{
protected static array $permissionActions = ["view", "create", "update", "delete", "restore", "forceDelete"];
protected static ?string $model = Project::class;
protected static string | \BackedEnum | null $navigationIcon = 'heroicon-o-building-office-2';
protected static string | \UnitEnum | null $navigationGroup = NavigationGroup::PROJECT->value;

View File

@@ -13,6 +13,7 @@ use App\Filament\Resources\SalesPhases\Tables\SalesPhasesTable;
class SalesPhaseResource extends Resource
{
protected static array $permissionActions = ["view", "create", "update", "delete", "restore", "forceDelete"];
protected static ?string $model = SalesPhase::class;
protected static string | \BackedEnum | null $navigationIcon = 'heroicon-o-rocket-launch';
protected static string | \UnitEnum | null $navigationGroup = NavigationGroup::WAREHOUSE->value;

View File

@@ -13,6 +13,7 @@ use App\Filament\Resources\Settlements\Tables\SettlementsTable;
class SettlementResource extends Resource
{
protected static array $permissionActions = ["view", "create", "update", "delete", "restore", "forceDelete"];
protected static ?string $model = Settlement::class;
protected static string | \BackedEnum | null $navigationIcon = 'heroicon-o-clipboard-document-check';
protected static string | \UnitEnum | null $navigationGroup = NavigationGroup::TRANSACTION->value;