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:
@@ -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'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user