Cleanup: For peace of mind
Removed code snippets related to profile update which are not in used anymore and create confusions.
This commit is contained in:
@@ -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.
|
* het locale for language.
|
||||||
*
|
*
|
||||||
|
@@ -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.
|
* User Assign Org.
|
||||||
*
|
*
|
||||||
|
@@ -308,59 +308,4 @@ class UserController extends Controller
|
|||||||
// return $date;
|
// return $date;
|
||||||
// //return substr($date, 0, -6);
|
// //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'));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -665,12 +665,6 @@ Route::group(['middleware' => ['web']], function () {
|
|||||||
Route::get('published/{id}', ['as' => 'published', 'uses' => 'Agent\kb\SettingsController@publish']);
|
Route::get('published/{id}', ['as' => 'published', 'uses' => 'Agent\kb\SettingsController@publish']);
|
||||||
/* Route for deleting comments */
|
/* Route for deleting comments */
|
||||||
Route::delete('deleted/{id}', ['as' => 'deleted', 'uses' => 'Agent\kb\SettingsController@delete']);
|
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 */
|
/* delete Logo */
|
||||||
Route::get('delete-logo/{id}', ['as' => 'delete-logo', 'uses' => 'Agent\kb\SettingsController@deleteLogo']);
|
Route::get('delete-logo/{id}', ['as' => 'delete-logo', 'uses' => 'Agent\kb\SettingsController@deleteLogo']);
|
||||||
/* delete Background */
|
/* delete Background */
|
||||||
@@ -720,10 +714,6 @@ Route::group(['middleware' => ['web']], function () {
|
|||||||
//to get the value for page content
|
//to get the value for page content
|
||||||
Route::get('pages/{name}', ['as' => 'pages', 'uses' => 'Client\kb\UserController@getPage']);
|
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('/inbox/data', ['as' => 'api.inbox', 'uses' => 'Agent\helpdesk\TicketController@get_inbox']);
|
||||||
// Route::get('/report', 'HomeController@getreport');
|
// Route::get('/report', 'HomeController@getreport');
|
||||||
// Route::get('/reportdata', 'HomeController@pushdata');
|
// Route::get('/reportdata', 'HomeController@pushdata');
|
||||||
|
Reference in New Issue
Block a user