File tree Expand file tree Collapse file tree 4 files changed +38
-3
lines changed Expand file tree Collapse file tree 4 files changed +38
-3
lines changed Original file line number Diff line number Diff line change @@ -115,6 +115,36 @@ public static function table(Table $table): Table
115
115
])
116
116
->bulkActions ([
117
117
Tables \Actions \DeleteBulkAction::make (),
118
+ Tables \Actions \BulkAction::make ('delete_banned ' )
119
+ ->label (__ ('Supprimer les utilisateurs bannis ' ))
120
+ ->icon ('heroicon-o-trash ' )
121
+ ->color ('danger ' )
122
+ ->action (function ($ records ): void {
123
+
124
+ $ bannedUsers = $ records ->whereNotNull ('banned_at ' );
125
+
126
+ if ($ bannedUsers ->isEmpty ()) {
127
+ Notification::make ()
128
+ ->warning ()
129
+ ->title (__ ('actions.delete_none ' ))
130
+ ->body (__ ('actions.delete_none_description ' ))
131
+ ->send ();
132
+
133
+ return ;
134
+ }
135
+
136
+ $ bannedUsers ->each (function (User $ user ): void {
137
+ $ user ->delete ();
138
+ });
139
+
140
+ Notification::make ()
141
+ ->success ()
142
+ ->title (__ ('actions.delete_success ' ))
143
+ ->body (__ ('actions.delete_success_description ' ))
144
+ ->send ();
145
+ })
146
+ ->requiresConfirmation ()
147
+ ->deselectRecordsAfterCompletion (),
118
148
]);
119
149
}
120
150
Original file line number Diff line number Diff line change @@ -18,8 +18,6 @@ public function getTabs(): array
18
18
'all ' => Tab::make (__ ('global.all ' )),
19
19
'banned ' => Tab::make (__ ('global.banned ' ))
20
20
->modifyQueryUsing (fn ($ query ) => $ query ->isBanned ()),
21
- 'unbanned ' => Tab::make (__ ('global.unbanned ' ))
22
- ->modifyQueryUsing (fn ($ query ) => $ query ->isNotBanned ()),
23
21
];
24
22
}
25
23
}
Original file line number Diff line number Diff line change 15
15
'confirm ' => 'Confirm ' ,
16
16
'start ' => 'Start ' ,
17
17
'view ' => 'View ' ,
18
-
18
+ 'delete_none ' => 'No users to delete ' ,
19
+ 'delete_none_description ' => 'No banned users were found in the selection. ' ,
20
+ 'delete_success ' => 'Users successfully deleted. ' ,
21
+ 'delete_success_description ' => 'Only banned users have been deleted. ' ,
19
22
];
Original file line number Diff line number Diff line change 15
15
'confirm ' => 'Confirmer ' ,
16
16
'start ' => 'Démarrer ' ,
17
17
'view ' => 'Voir ' ,
18
+ 'delete_none ' => 'Aucun utilisateur à supprimer ' ,
19
+ 'delete_none_description ' => 'Aucun utilisateur banni n \'a été trouvé dans la sélection ' ,
20
+ 'delete_success ' => 'Suppression effectuée ' ,
21
+ 'delete_success_description ' => 'Seuls les utilisateurs bannis ont été supprimés. ' ,
18
22
];
You can’t perform that action at this time.
0 commit comments