Skip to content

Commit

Permalink
Display roles as badge in user list (#772)
Browse files Browse the repository at this point in the history
  • Loading branch information
Boy132 authored Dec 6, 2024
1 parent b50acfd commit 5317f97
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions app/Filament/Resources/UserResource/Pages/ListUsers.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,13 @@ public function table(Table $table): Table
->label('2FA')
->visibleFrom('lg')
->icon(fn (User $user) => $user->use_totp ? 'tabler-lock' : 'tabler-lock-open-off')
->boolean()->sortable(),
TextColumn::make('roles_count')
->counts('roles')
->icon('tabler-users-group')
->boolean()
->sortable(),
TextColumn::make('roles.name')
->label('Roles')
->formatStateUsing(fn (User $user, $state) => $state . ($user->isRootAdmin() ? ' (Root Admin)' : '')),
->badge()
->icon('tabler-users-group')
->placeholder('No roles'),
TextColumn::make('servers_count')
->counts('servers')
->icon('tabler-server')
Expand All @@ -65,7 +66,6 @@ public function table(Table $table): Table
->label('Subusers')
->counts('subusers')
->icon('tabler-users'),
// ->formatStateUsing(fn (string $state, $record): string => (string) ($record->servers_count + $record->subusers_count))
])
->actions([
EditAction::make(),
Expand Down

0 comments on commit 5317f97

Please sign in to comment.