- 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)
58 lines
1.4 KiB
PHP
58 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Resources\Users;
|
|
|
|
use App\Filament\Resources\Users\Pages\CreateUser;
|
|
use App\Filament\Resources\Users\Pages\EditUser;
|
|
use App\Filament\Resources\Users\Pages\ListUsers;
|
|
use App\Filament\Resources\Users\Schemas\UserForm;
|
|
use App\Filament\Resources\Users\Tables\UsersTable;
|
|
use App\Models\User;
|
|
use BackedEnum;
|
|
use Filament\Resources\Resource;
|
|
use Filament\Schemas\Schema;
|
|
use Filament\Support\Icons\Heroicon;
|
|
use Filament\Tables\Table;
|
|
|
|
class UserResource extends Resource
|
|
{
|
|
protected static ?string $model = User::class;
|
|
|
|
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedUsers;
|
|
|
|
protected static ?string $pluralLabel = 'Users';
|
|
|
|
protected static ?int $navigationSort = 5;
|
|
|
|
protected static ?string $recordTitleAttribute = 'name';
|
|
|
|
public static function getNavigationGroup(): ?string
|
|
{
|
|
return 'Management';
|
|
}
|
|
|
|
public static function form(Schema $schema): Schema
|
|
{
|
|
return UserForm::configure($schema);
|
|
}
|
|
|
|
public static function table(Table $table): Table
|
|
{
|
|
return UsersTable::configure($table);
|
|
}
|
|
|
|
public static function getRelations(): array
|
|
{
|
|
return [];
|
|
}
|
|
|
|
public static function getPages(): array
|
|
{
|
|
return [
|
|
'index' => ListUsers::route('/'),
|
|
'create' => CreateUser::route('/create'),
|
|
'edit' => EditUser::route('/{record}/edit'),
|
|
];
|
|
}
|
|
}
|