I am trying to pass a pageTitle variable to the password reset template (/resources/views/auth/passwords/reset.blade.php) in Laravel 5.3 in the following way:
return view('auth.passwords.reset')
->with('pageTitle', 'Change title')
->with(['token' => $token, 'email' => $request->email]);
this goes in the showResetForm
method inside ResetsPasswords
trait - and it doesn't work. Google doesn't come up with any helpful results. I've tried removing the line:
->with(['token' => $token, 'email' => $request->email]);
but it still doesn't work. I've also tried
$pageTitle = 'Change me';
return view('auth.passwords.reset', compact('pageTitle'));
but it doesn't work. Also, I've realized that the ResetsPassword
trait is found in the vendor folder so it's a bad idea to change the code there, how do you suggest I do this instead? Can I overwrite the showResetForm
method somewhere? - I found that for the registration trait I can put the showRegistrationForm
in the RegistrationController
and pass whatever variables I want to the view there; however that doesn't work for the ResetPasswordController
EDIT:
Here is the whole method from the ResetsPasswords
trait, as requested:
/**
* Display the password reset view for the given token.
*
* If no token is present, display the link request form.
*
* @param \Illuminate\Http\Request $request
* @param string|null $token
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function showResetForm(Request $request, $token = null)
{
return view('auth.passwords.reset')->with(['token' => $token, 'email' => $request->email]);
}