From 7f516633b7aeb51aeef0308ed88c8cdc11ed8c71 Mon Sep 17 00:00:00 2001 From: Martin Meredith Date: Tue, 9 Aug 2016 11:24:42 +0100 Subject: [PATCH] Check for when we have no selected users --- frontend/app/controllers/AdminController.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/frontend/app/controllers/AdminController.php b/frontend/app/controllers/AdminController.php index d29af9e15..be3a5c42e 100644 --- a/frontend/app/controllers/AdminController.php +++ b/frontend/app/controllers/AdminController.php @@ -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"); } }