Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 33 additions & 1 deletion app/Filament/Resources/UserResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public static function table(Table $table): Table
->placeholder('N/A')
->date(),
Tables\Columns\TextColumn::make(name: 'created_at')
->label(__('use.inscription'))
->label(__('user.inscription'))
->date(),
])
->filters([
Expand Down Expand Up @@ -115,6 +115,38 @@ public static function table(Table $table): Table
])
->bulkActions([
Tables\Actions\DeleteBulkAction::make(),
Tables\Actions\BulkAction::make('delete_banned')
->label(__('Supprimer les utilisateurs bannis'))
->icon('heroicon-o-trash')
->color('danger')
->action(function ($records): void {

$bannedUsers = $records->whereNotNull('banned_at');

if ($bannedUsers->isEmpty()) {
Notification::make()
->warning()
->title(__('actions.delete_none'))
->duration(5000)
->body(__('actions.delete_none_description'))
->send();

return;
}

$bannedUsers->each(function (User $user): void {
$user->delete();
});

Notification::make()
->success()
->title(__('actions.delete_success'))
->duration(5000)
->body(__('actions.delete_success_description'))
->send();
})
->requiresConfirmation()
->deselectRecordsAfterCompletion(),
]);
}

Expand Down
2 changes: 0 additions & 2 deletions app/Filament/Resources/UserResource/Pages/ListUsers.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ public function getTabs(): array
'all' => Tab::make(__('global.all')),
'banned' => Tab::make(__('global.banned'))
->modifyQueryUsing(fn ($query) => $query->isBanned()),
'unbanned' => Tab::make(__('global.unbanned'))
->modifyQueryUsing(fn ($query) => $query->isNotBanned()),
];
}
}
Loading
Loading