Monday, 20 March 2017

Topic 11 - Mail Notifications

Laravel comes out with email notification features provide a proper feedback for user.

First of, to create new mail notification you can write in CMD on your project folder

php arisan make:notification YourNotification

Then you can configure how your notification looks like in Notifications/YourNotification.php folder :
public function toMail($notifiable)
{
    $url = url('/invoice/'.$this->invoice->id);

    return (new MailMessage)
                ->greeting('Hello!')
                ->line('One of your invoices has been paid!')
                ->action('View Invoice', $url)
                ->line('Thank you for using our application!');
}
 Result as below :



References :

https://laracasts.com/series/whats-new-in-laravel-5-3/episodes/9
https://laravel.com/docs/5.4/notifications

No comments:

Post a Comment