/
home
/
sjslayjy
/
public_html
/
assets
/
app
/
Http
/
Controllers
/
Upload File
HOME
<?php namespace App\Http\Controllers; use Illuminate\Http\Request; use App\LocalUserMapping; use Auth; use DB; class UserController extends Controller { public $data; public function get_common(){ if(Auth::check()){ $user = Auth::user(); $this->data['userInfo'] = LocalUserMapping::where('LoginID',$user->loginId)->first(); } } public function get_change_password(){ $this->get_common(); return view('user.change-password',$this->data); } public function ChangePassword(Request $request) { $response = array(); $user = \App\User::find(\Auth::user()->id); $old_password = $request->old_password; $new_password = $request->new_password; if(\Hash::check($old_password, $user->getAuthPassword())){ $user->password = \Hash::make($new_password); if($user->save()){ return redirect('change-password')->with("success","Successfully Change Your Password"); // $response['error'] = "Change Password Successfully"; }else{ return redirect('change-password')->with("error","something went wrong"); // $response['error'] = "Invalid Old Password"; } }else{ return redirect('change-password')->with("error","something went wrong"); } } }