- 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)
60 lines
1.6 KiB
PHP
60 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Resources\Users\Tables;
|
|
|
|
use Filament\Actions\BulkActionGroup;
|
|
use Filament\Actions\DeleteBulkAction;
|
|
use Filament\Actions\EditAction;
|
|
use Filament\Tables\Columns\TextColumn;
|
|
use Filament\Tables\Table;
|
|
|
|
class UsersTable
|
|
{
|
|
public static function configure(Table $table): Table
|
|
{
|
|
return $table
|
|
->columns([
|
|
TextColumn::make('id')
|
|
->label('#')
|
|
->sortable(),
|
|
|
|
TextColumn::make('name')
|
|
->searchable()
|
|
->sortable(),
|
|
|
|
TextColumn::make('email')
|
|
->searchable()
|
|
->sortable(),
|
|
|
|
TextColumn::make('role')
|
|
->badge()
|
|
->color(fn (string $state): string => match ($state) {
|
|
'admin' => 'danger',
|
|
'manager' => 'warning',
|
|
'staff' => 'info',
|
|
default => 'gray',
|
|
}),
|
|
|
|
TextColumn::make('created_at')
|
|
->dateTime('d/m/Y H:i')
|
|
->sortable()
|
|
->toggleable(isToggledHiddenByDefault: true),
|
|
])
|
|
->defaultSort('id', 'asc')
|
|
->filters([
|
|
//
|
|
])
|
|
->recordActions([
|
|
EditAction::make(),
|
|
])
|
|
->headerActions([
|
|
//
|
|
])
|
|
->bulkActions([
|
|
BulkActionGroup::make([
|
|
DeleteBulkAction::make(),
|
|
]),
|
|
]);
|
|
}
|
|
}
|