How to send error in laravel response? -


i writing code changing password. code follows:

public function changepassword(changepasswordrequest $request) {       $credentials = ['email'=>auth::user()->email, 'password'=>$request['old_password']];      if (auth::validate($credentials))     {         password change code;     }     else     {         should there?     } } 

without using ajax can return redirect view errors. should error sending code in else part when using ajax, if old password wrong? can match old password in changepasswordrequest.php well?

return response()->json(['old_password'=> ["your old password not correct."] ], 403); 

Comments

Popular posts from this blog

tcpdump - How to check if server received packet (acknowledged) -