Latest

Monday, July 10, 2017

unable to send data to my custom password reset blade laravel

Asked by: EaB


I have just replaced my reset password default template with my custom template for reset password.

here is what i have done (I'M USING LARAVEL 5.4) :

  1. in vendor/laravel/framework/src/Illuminate/Auth/Notifications/ResetPassword.php changed function now it looks like this

public function toMail($notifiable) {

return (new MailMessage)->with('token', $this->token); 
    // ->line('You are receiving this email because we received a password reset request for your account.')
    // ->action('Reset Password', url(config('app.url').route('password.reset', $this->token, false)))
    // ->line('If you did not request a password reset, no further action is required.');

}

  1. i'm successfully able to send the email

  2. but when i try to access the {{$token}} in resources/views/vendor/notifications/email.blade.php

it gives the following error

enter image description here

how i'm trying to send data is:

   public function toMail($notifiable) {

      return (new MailMessage)->with('token', $this->token); 

    }

in this vendor/laravel/framework/src/Illuminate/Auth/Notifications/ResetPassword.php class $token is public and been assigned inside constructor

Question: how to send $token to resources/views/vendor/notifications/email.blade.php

please help me thanks in advance!!!


Answers

Answered by: Kuldeep Mishra at 2017-07-11 12:52PM



You can try with following:

public function toMail($notifiable) {
  return (new MailMessage)->with('token'=>$this->token); 
}



Source

No comments:

Post a Comment

Adbox