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

python - Overwriting the save method of a Django model -

java - how to browse all messages from 2 different MQQueue in the same function? -

How to run C# code using mono without Xamarin in Android? -