Multiple Call to Actions on Notifications

Posted 1 year ago by Bartude

Hey guys,

According to the documentation: 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.

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up


Reply to

Use Markdown with GitHub-flavored code blocks.