Laravel 5.1 has this code:
public function postEmail(Request $request) { $this->validate($request, ['email' => 'required|email']); $response = Password::sendResetLink($request->only('email'), function (Message $message) { $message->subject($this->getEmailSubject()); }); switch ($response) { case Password::RESET_LINK_SENT: return redirect()->back()->with('status', trans($response));/*I HAVE TO CHANGE THIS*/ case Password::INVALID_USER: return redirect()->back()->withErrors(['email' => trans($response)]); } } That code it's from a trait: app\vendor\laravel\framework\src\Illuminate\Foundation\Auth\ResetsPasswords.php
I need to change the line with the comment with another code:
return redirect()->route('login')->with(['message' => 'Se ha enviado a su email el link del reseteo, por favor verifique.',]); But it's a vendor file. How can I do this? overwrite the method in another file? where?
postEmailmethod?PasswordControlleruseuse Illuminate\Foundation\Auth\ResetsPasswords;and which is a trait, the methodpostEmail()is therepostEmailby creating your ownpostEmailmethod. When the route will call the actionResetPasswordController@postEmail(or whatever was is name on 5.1), it will call your instead of vendor.