Initial commit: Pireon Admin — headless admin panel and public API
Laravel 13 + Filament 5 admin panel and REST API for a non-profit developer collective, backed by the Pireon OAuth identity server. The public site is a separate, server-rendered application consuming /api/public/v1. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
53
app/Filament/Resources/Roles/Tables/RolesTable.php
Normal file
53
app/Filament/Resources/Roles/Tables/RolesTable.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Filament\Resources\Roles\Tables;
|
||||
|
||||
use App\Support\Permissions;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
use Spatie\Permission\Models\Role;
|
||||
|
||||
class RolesTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->defaultSort('name')
|
||||
->columns([
|
||||
TextColumn::make('name')
|
||||
->label(__('panel.roles.fields.name'))
|
||||
->weight('medium')
|
||||
->badge()
|
||||
->color(fn (string $state) => $state === 'super_admin' ? 'danger' : 'primary')
|
||||
->description(fn (Role $record) => in_array($record->name, Permissions::protectedRoles(), true)
|
||||
? __('panel.roles.protected')
|
||||
: null)
|
||||
->searchable()
|
||||
->sortable(),
|
||||
|
||||
TextColumn::make('permissions_count')
|
||||
->label(__('panel.roles.fields.permissions'))
|
||||
->counts('permissions')
|
||||
// super_admin holds no permission rows: it is granted
|
||||
// everything by the Gate::before hook instead.
|
||||
->formatStateUsing(fn ($state, Role $record) => $record->name === 'super_admin'
|
||||
? '∞'
|
||||
: $state)
|
||||
->badge(),
|
||||
|
||||
TextColumn::make('users_count')
|
||||
->label(__('panel.roles.fields.users_count'))
|
||||
->counts('users')
|
||||
->badge()
|
||||
->color('gray'),
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
DeleteAction::make(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user