From a80f3f6cf3cc163cb118d27152c14271fd49557d Mon Sep 17 00:00:00 2001 From: Manish Verma Date: Thu, 16 Aug 2018 06:16:34 +0000 Subject: [PATCH] Apply fixes from StyleCI --- .../Admin/helpdesk/SettingsController.php | 31 ++++++++++++------- config/app.php | 2 +- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/app/Http/Controllers/Admin/helpdesk/SettingsController.php b/app/Http/Controllers/Admin/helpdesk/SettingsController.php index ee1790a3c..a1004930b 100644 --- a/app/Http/Controllers/Admin/helpdesk/SettingsController.php +++ b/app/Http/Controllers/Admin/helpdesk/SettingsController.php @@ -1052,26 +1052,33 @@ class SettingsController extends Controller /** * @category function to return clean data view + * * @param null + * * @return respone/view */ - public function getCleanUpView() { + public function getCleanUpView() + { $system_check = CommonSettings::select('status')->where('option_name', '=', 'dummy_data_installation')->first(); if ($system_check) { if ($system_check->status == 1 || $system_check->status == '1') { return View('themes.default1.admin.helpdesk.settings.cleandata'); } } + return redirect()->route('error404')->with('fails', Lang::get('lang.no-dummy-data')); } /** * @category function to clean dummy database and reseed tables with default options + * * @param null + * * @return * Very dangerous function should be call by admin only */ - private function cleanDatabase() { + private function cleanDatabase() + { try { $user = \App\User::select( 'user_name', 'first_name', 'last_name', 'email', 'password', 'agent_tzone' @@ -1096,16 +1103,16 @@ class SettingsController extends Controller DB::commit(); \Artisan::call('db:seed', ['--force' => true]); $user2 = \App\User::updateOrCreate(['id' => 1], [ - 'first_name' => $user->first_name, - 'last_name' => $user->last_name, - 'email' => $user->email, - 'user_name' => $user->user_name, - 'password' => $user->password, + 'first_name' => $user->first_name, + 'last_name' => $user->last_name, + 'email' => $user->email, + 'user_name' => $user->user_name, + 'password' => $user->password, 'assign_group' => 1, - 'primary_dpt' => 1, - 'active' => 1, - 'agent_tzone' => $user->agent_tzone, - 'role' => 'admin', + 'primary_dpt' => 1, + 'active' => 1, + 'agent_tzone' => $user->agent_tzone, + 'role' => 'admin', ]); $system2 = System::find(1); $system2->time_zone = $system->time_zone; @@ -1118,9 +1125,11 @@ class SettingsController extends Controller $bhours->save(); $response = 'success'; + return $response; } catch (\Exception $e) { $error = $e->getMessage(); + return $error; } } diff --git a/config/app.php b/config/app.php index f42a13854..e2a1f2c96 100644 --- a/config/app.php +++ b/config/app.php @@ -258,4 +258,4 @@ return [ 'Datatables' => Yajra\Datatables\Facades\Datatables::class, 'Notification' => Illuminate\Support\Facades\Notification::class, ], -]; \ No newline at end of file +];