Bartude
990
6
Laravel

Multiple Call to Actions on Notifications

Posted 1 year ago by Bartude

Hey guys,

According to the documentation: https://laravel.com/docs/5.5/notifications#markdown-mail-notifications I can add as many button components as I want to a notification, but it's not working. It's only adding one button and it's the last one in my notification:

public function toMail($notifiable)
    {
        return (new MailMessage)
                    ->subject('Registration complete')
                    ->greeting('Hey ' . $this->name)
                    ->line('Here are two buttons!')
                    ->action('Buttons1', url('/button1url'))
                    ->action('Button2', url('/button2url'))
                    ->line('See you soon,');
    }

I've published the notification view and checked the MailMessage class and I can probably solve this by modifying a bit this class to make it work, but if in the documentation it says I can add multiple buttons, there must be something I'm missing. Any ideas?

Please sign in or create an account to participate in this conversation.