Skip to content

Commit

Permalink
Check for when we have no selected users
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Meredith committed Aug 11, 2016
1 parent 50dcca3 commit 7f51663
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions frontend/app/controllers/AdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,16 @@ public function showConsole() {

public function deleteOrRestoreUsers() {
$input = Input::get('selected_users');
foreach($input as $single_input) {
$user = User::withTrashed()->where('id', '=', $single_input);
if(Input::get('restore')) {
$user->restore();
}else{
$user->delete();
}
}
if (!empty($input)) {
foreach ($input as $single_input) {
$user = User::withTrashed()->where('id', '=', $single_input);
if (Input::get('restore')) {
$user->restore();
} else {
$user->delete();
}
}
}
return Redirect::route("admin/console");
}
}

0 comments on commit 7f51663

Please sign in to comment.