From 2f985011e9618b69806c733d7fb7d720b433a8a1 Mon Sep 17 00:00:00 2001 From: Manish Verma Date: Fri, 17 Dec 2021 11:46:55 +0530 Subject: [PATCH] Cleanup: For peace of mind Removed code snippets related to profile update which are not in used anymore and create confusions. --- .../Agent/kb/SettingsController.php | 79 ----------------- app/Http/Controllers/Auth/UserController.php | 88 ------------------- .../Controllers/Client/kb/UserController.php | 55 ------------ routes/web.php | 10 --- 4 files changed, 232 deletions(-) diff --git a/app/Http/Controllers/Agent/kb/SettingsController.php b/app/Http/Controllers/Agent/kb/SettingsController.php index ba6846e41..a69df4a45 100644 --- a/app/Http/Controllers/Agent/kb/SettingsController.php +++ b/app/Http/Controllers/Agent/kb/SettingsController.php @@ -205,85 +205,6 @@ class SettingsController extends Controller } } - /** - * get profile page. - * - * @return type view - */ - public function getProfile() - { - $time = Timezone::all(); - $user = Auth::user(); - - return view('themes.default1.agent.kb.settings.profile', compact('user', 'time')); - } - - /** - * Post profile page. - * - * @param type ProfileRequest $request - * - * @return type redirect - */ - public function postProfile(ProfileRequest $request) - { - $user = Auth::user(); - $user->gender = $request->input('gender'); - $user->save(); - if (is_null($user->profile_pic)) { - if ($request->input('gender') == 1) { - $name = 'avatar5.png'; - $destinationPath = 'lb-faveo/dist/img'; - $user->profile_pic = $name; - } elseif ($request->input('gender') == 0) { - $name = 'avatar2.png'; - $destinationPath = 'lb-faveo/dist/img'; - $user->profile_pic = $name; - } - } - if (Input::file('profile_pic')) { - //$extension = Input::file('profile_pic')->getClientOriginalExtension(); - $name = Input::file('profile_pic')->getClientOriginalName(); - $destinationPath = 'lb-faveo/dist/img'; - $fileName = rand(0000, 9999).'.'.$name; - //echo $fileName; - Input::file('profile_pic')->move($destinationPath, $fileName); - $user->profile_pic = $fileName; - } else { - $user->fill($request->except('profile_pic', 'gender','active','role','is_delete','ban'))->save(); - - return redirect()->back()->with('success1', 'Profile Updated sucessfully'); - } - if ($user->fill($request->except('profile_pic','active','role','is_delete','ban'))->save()) { - return redirect('profile')->with('success1', 'Profile Updated sucessfully'); - } else { - return redirect('profile')->with('fails1', 'Profile Not Updated sucessfully'); - } - } - - /** - * post profile password. - * - * @param type $id - * @param type ProfilePassword $request - * - * @return type redirect - */ - public function postProfilePassword($id, ProfilePassword $request) - { - $user = Auth::user(); - //echo $user->password; - - if (Hash::check($request->input('old_password'), $user->getAuthPassword())) { - $user->password = Hash::make($request->input('new_password')); - $user->save(); - - return redirect('profile')->with('success2', 'Password Updated sucessfully'); - } else { - return redirect('profile')->with('fails2', 'Old password Wrong'); - } - } - /** * het locale for language. * diff --git a/app/Http/Controllers/Auth/UserController.php b/app/Http/Controllers/Auth/UserController.php index 6674bf7c3..9dddbc224 100644 --- a/app/Http/Controllers/Auth/UserController.php +++ b/app/Http/Controllers/Auth/UserController.php @@ -287,94 +287,6 @@ class UserController extends Controller } } - /** - * get profile page. - * - * @return type Response - */ - public function getProfile() - { - $user = Auth::user(); - - return view('themes.default1.agent.helpdesk.user.profile', compact('user')); - } - - /** - * get profile edit page. - * - * @return type Response - */ - public function getProfileedit() - { - $user = Auth::user(); - - return view('themes.default1.agent.helpdesk.user.profile-edit', compact('user')); - } - - /** - * post profile page. - * - * @param type int $id - * @param type ProfileRequest $request - * - * @return type Response - */ - public function postProfileedit(ProfileRequest $request) - { - $user = Auth::user(); - $user->gender = $request->input('gender'); - $user->save(); - if ($user->profile_pic == 'avatar5.png' || $user->profile_pic == 'avatar2.png') { - if ($request->input('gender') == 1) { - $name = 'avatar5.png'; - $destinationPath = 'uploads/profilepic'; - $user->profile_pic = $name; - } elseif ($request->input('gender') == 0) { - $name = 'avatar2.png'; - $destinationPath = 'uploads/profilepic'; - $user->profile_pic = $name; - } - } - if (Input::file('profile_pic')) { - //$extension = Input::file('profile_pic')->getClientOriginalExtension(); - $name = Input::file('profile_pic')->getClientOriginalName(); - $destinationPath = 'uploads/profilepic'; - $fileName = rand(0000, 9999).'.'.$name; - //echo $fileName; - Input::file('profile_pic')->move($destinationPath, $fileName); - $user->profile_pic = $fileName; - } else { - $user->fill($request->except('profile_pic', 'gender','active','role','is_delete','ban'))->save(); - - return Redirect::route('profile')->with('success', 'Profile Updated sucessfully'); - } - if ($user->fill($request->except('profile_pic','active','role','is_delete','ban'))->save()) { - return Redirect::route('profile')->with('success', 'Profile Updated sucessfully'); - } - } - - /** - * Post profile password. - * - * @param type int $id - * @param type ProfilePassword $request - * - * @return type Response - */ - public function postProfilePassword($id, ProfilePassword $request) - { - $user = Auth::user(); - //echo $user->password; - if (Hash::check($request->input('old_password'), $user->getAuthPassword())) { - $user->password = Hash::make($request->input('new_password')); - $user->save(); - - return redirect('profile-edit')->with('success1', 'Password Updated sucessfully'); - } else { - return redirect('profile-edit')->with('fails1', 'Password was not Updated. Incorrect old password'); - } - } - /** * User Assign Org. * diff --git a/app/Http/Controllers/Client/kb/UserController.php b/app/Http/Controllers/Client/kb/UserController.php index 1f58e3a30..56d321af2 100644 --- a/app/Http/Controllers/Client/kb/UserController.php +++ b/app/Http/Controllers/Client/kb/UserController.php @@ -308,59 +308,4 @@ class UserController extends Controller // return $date; // //return substr($date, 0, -6); // } - - public function clientProfile() - { - $user = Auth::user(); - - return view('themes.default1.client.kb.article-list.profile', compact('user')); - } - - public function postClientProfile($id, ProfileRequest $request) - { - $user = Auth::user(); - $user->gender = $request->input('gender'); - $user->save(); - if ($user->profile_pic == 'avatar5.png' || $user->profile_pic == 'avatar2.png') { - if ($request->input('gender') == 1) { - $name = 'avatar5.png'; - $destinationPath = 'lb-faveo/dist/img'; - $user->profile_pic = $name; - } elseif ($request->input('gender') == 0) { - $name = 'avatar2.png'; - $destinationPath = 'lb-faveo/dist/img'; - $user->profile_pic = $name; - } - } - if (Input::file('profile_pic')) { - //$extension = Input::file('profile_pic')->getClientOriginalExtension(); - $name = Input::file('profile_pic')->getClientOriginalName(); - $destinationPath = 'lb-faveo/dist/img'; - $fileName = rand(0000, 9999).'.'.$name; - //echo $fileName; - Input::file('profile_pic')->move($destinationPath, $fileName); - $user->profile_pic = $fileName; - } else { - $user->fill($request->except('profile_pic', 'gender','active','role','is_delete','ban'))->save(); - - return redirect('guest')->with('success', Lang::get('lang.profile_updated_sucessfully')); - } - if ($user->fill($request->except('profile_pic', 'active','role','is_delete','ban'))->save()) { - return redirect('guest')->with('success', Lang::get('lang.sorry_not_proprofile_updated_sucessfullycessed')); - } - } - - public function postClientProfilePassword($id, ProfilePassword $request) - { - $user = Auth::user(); - //echo $user->password; - if (Hash::check($request->input('old_password'), $user->getAuthPassword())) { - $user->password = Hash::make($request->input('new_password')); - $user->save(); - - return redirect()->back()->with('success', Lang::get('lang.password_updated_sucessfully')); - } else { - return redirect()->back()->with('fails', Lang::get('lang.password_was_not_updated')); - } - } } diff --git a/routes/web.php b/routes/web.php index b97f871fa..39b2014c0 100644 --- a/routes/web.php +++ b/routes/web.php @@ -665,12 +665,6 @@ Route::group(['middleware' => ['web']], function () { Route::get('published/{id}', ['as' => 'published', 'uses' => 'Agent\kb\SettingsController@publish']); /* Route for deleting comments */ Route::delete('deleted/{id}', ['as' => 'deleted', 'uses' => 'Agent\kb\SettingsController@delete']); - /* Route for Profile */ - // $router->get('profile', ['as' => 'profile', 'uses' => 'Agent\kb\SettingsController@getProfile']); - /* Profile Update */ - // $router->patch('post-profile', ['as' => 'post-profile', 'uses' =>'Agent\kb\SettingsController@postProfile'] ); - /* Profile password Update */ - // $router->patch('post-profile-password/{id}',['as' => 'post-profile-password', 'uses' => 'Agent\kb\SettingsController@postProfilepassword']); /* delete Logo */ Route::get('delete-logo/{id}', ['as' => 'delete-logo', 'uses' => 'Agent\kb\SettingsController@deleteLogo']); /* delete Background */ @@ -720,10 +714,6 @@ Route::group(['middleware' => ['web']], function () { //to get the value for page content Route::get('pages/{name}', ['as' => 'pages', 'uses' => 'Client\kb\UserController@getPage']); - //profile - // $router->get('client-profile',['as' => 'client-profile', 'uses' => 'Client\kb\UserController@clientProfile']); - // Route::patch('client-profile-edit',['as' => 'client-profile-edit', 'uses' => 'Client\kb\UserController@postClientProfile']); - // Route::patch('client-profile-password/{id}',['as' => 'client-profile-password', 'uses' => 'Client\kb\UserController@postClientProfilePassword']); Route::get('/inbox/data', ['as' => 'api.inbox', 'uses' => 'Agent\helpdesk\TicketController@get_inbox']); // Route::get('/report', 'HomeController@getreport'); // Route::get('/reportdata', 'HomeController@pushdata');