Custom Email template for Laravel Password Reset
Today I got new task with laravel , since I have forget passwrod reset scenario.
It works but not using the UIs of our theme.Scpecailly mail.
However reset pasword section of the follwing helps me .
http://miftyisbored.com/a-complete-laravel-5-3-tutorial-for-user-authentication-with-activation-email/
Mailtrap will help you.
It works but not using the UIs of our theme.Scpecailly mail.
However reset pasword section of the follwing helps me .
http://miftyisbored.com/a-complete-laravel-5-3-tutorial-for-user-authentication-with-activation-email/
Mailtrap will help you.
- php artisan vendor:publish --tag=laravel-notifications // email template
- php artisan make:notification ResetPassword. .//edit temaplte parameters
- chage user class to call notification
public function sendPasswordResetNotification($token)
{
$this->notify(new ResetPassword($token));
}
- change ResetPassword in notification folder
eg :
namespace App\Notifications;
use Illuminate\Notifications\Notification;
use Illuminate\Notifications\Messages\MailMessage;
class PasswordResetNotification extends Notification
{
/**
* The password reset token.
*
* @var string
*/
public $token;
/**
* Create a notification instance.
*
* @param string $token
* @return void
*/
public function __construct($token)
{
$this->token = $token;
}
/**
* Get the notification's channels.
*
* @param mixed $notifiable
* @return array|string
*/
public function via($notifiable)
{
return ['mail'];
}
/**
* Get the notification message.
*
* @param mixed $notifiable
* @return \Illuminate\Notifications\MessageBuilder
*/
public function toMail($notifiable)
{
return (new MailMessage)
->subject('Password Reset Request')
->greeting('Hello, '.$notifiable->username)
->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).'?email='.urlencode($notifiable->email))
->line('If you did not request a password reset, no further action is required.')
->line('Thank you for using '. config('app.name'));
}
}
- Customise the template in views/vender/notifications/email.blade. The above parameters can be used within the emai with diffrent vales passsed by you in above. eg greetings
Comments
Post a Comment