mercredi 31 août 2016

Getting Error while Overriding Password Reset Template Laravel 5.3

hello i have just started working on laravel 5.3 and soon came across this issue. Unlike 5.2, where we have hardcoded emails or some custom packages, here we are restricted to a single template.

So first of all i have updated the user model to include

public function sendPasswordResetNotification($token)
{
    $this->notify(new ResetPasswordNotification($token));
}

Then i have a notification file called ResetPasswordNotification and inside i have a

 public function toMail()
    {
        return (new MailMessage)
            ->line([
                'You are receiving this email because we received a password reset request for your account.',
                'Click the button below to reset your password:',
            ])
            ->action('Reset Password', url('password/reset', $this->token))
            ->line('If you did not request a password reset, no further action is required.');
    }

But i want to include a custom email template views and send data to these views like how we did earlier. Now to impliment the old style in the new laravel we have to adopt it like this.

return (new MailMessage) ->view('emails.templates.layout5') ->data([ 'pageTitle' => 'Password Reset', 'logo' => $logo, 'topMenu' => 'TOP MENU', 'mainTitle' => 'Verify email to', 'subTitle' => 'Reset Your Password', 'image' => 'largeimg.png', 'content' => $content, ]);

But when i do this, i get an error

ErrorException in MailChannel.php line 44:
Trying to get property of non-object



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2bCm96f
via IFTTT

Aucun commentaire:

Enregistrer un commentaire