Ad

How To Pass The Custom Variables From ResetPasswordController To Reset Blade

- 1 answer

How to pass the custom variables from ResetPasswordController to reset blade template.

ResetPasswordController.php

 public function showResetForm(Request $request, $token = null)
 {
    $data = array(
        'title'=>'Reset password',
        'description'=> 'Reset password to abc.com',
        'seo_keywords'=> 'Reset password to abc.com',
      );
      return view('auth/password/reset',$data);

 }
Ad

Answer

By returning a view(), the second argument can be used to pass variables to the blade template (just like you have done)

public function showResetForm(Request $request, $token = null)
{
    return view('auth/password/reset',[
        'title'         =>'Reset password',
        'description'   => 'Reset password to abc.com',
        'seo_keywords'  => 'Reset password to abc.com',
    ]);
}

These would then be accessable as {{ $title }}, {{ $description}}, {{ $seo_keywords}}.

If you are unable to retrieve these, it may be because you are editting the wrong blade template. The default template is located at auth.passwords.reset (resources/views/auth/passwords/reset.blade.php).

I'd suggest just adding a {{ dd('here) }} at the top of that template to make sure it is in fact the template being used by your application!

Ad
source: stackoverflow.com
Ad