- PermissionSeeder: 29 permissions with role mapping (admin/manager/staff) - Policies updated to use hasPermissionTo() instead of hasRole() - ExportBackup command: JSON per-table backup with chunk processing - UserResource: CRUD users with role assignment (admin only) - RoleResource: CRUD roles with permission assignment (admin only) - UserPolicy + RolePolicy: admin-only access control - ImportCskh: detailed skip logging with color in dry-run mode - Widgets: permission-based visibility checks - Tests: 8/8 pass (21 assertions)
38 lines
1.2 KiB
PHP
38 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Resources\Roles\Schemas;
|
|
|
|
use Filament\Forms\Components\CheckboxList;
|
|
use Filament\Forms\Components\TextInput;
|
|
use Filament\Schemas\Schema;
|
|
use Filament\Schemas\Components\Section;
|
|
use Spatie\Permission\Models\Permission;
|
|
|
|
class RoleForm
|
|
{
|
|
public static function configure(Schema $schema): Schema
|
|
{
|
|
return $schema
|
|
->components([
|
|
Section::make()
|
|
->schema([
|
|
TextInput::make('name')
|
|
->label('Role Name')
|
|
->required()
|
|
->maxLength(255)
|
|
->unique(ignoreRecord: true),
|
|
]),
|
|
|
|
Section::make('Permissions')
|
|
->description('Chọn quyền cho role này')
|
|
->schema([
|
|
CheckboxList::make('permissions')
|
|
->label('')
|
|
->options(fn () => Permission::orderBy('name')->pluck('name', 'name')->toArray())
|
|
->columns(4)
|
|
->columnSpanFull(),
|
|
]),
|
|
]);
|
|
}
|
|
}
|