You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the documentation, it does mention that to use mail channel, we should return ['mail'] in the via method. So because I have two other custom channels, I did this at first:
[2017-05-24 03:24:48] local.ERROR: ErrorException: call_user_func() expects parameter 1 to be a valid callback, no array or string given in /var/www/html/vendor/laravel/framework/src/Illuminate/Notifications/Channels/MailChannel.php:75
Stack trace:
.... not important ...
Apparently, what happened here is MailChannel (line 69) is expecting MailMessage to provide a view, if not, provide a markdownResolver, but neither of these can be fulfilled because (1) MailMessage does not need to define a view, and (2) markdownResolver is not set from ChannelManager, in line 90, because it sorts of skipped when I use MailChannel::class.
Steps To Reproduce:
Create a new Notification called TestNotification.php under app/Notifications/:
<?php
namespace App\Notifications;
use Illuminate\Notifications\Channels\MailChannel;
use Illuminate\Notifications\Messages\MailMessage;
class TestNotification extends \Illuminate\Notifications\Notification
{
public function via($notifiable)
{
return [MailChannel::class];
}
public function toMail($notifiable)
{
return (new MailMessage())->subject('Test Notification')
->line('Hello World');
}
}
Use any notifiable model, and notify with this notification:
This would result in an error as (1) view is not defined in MailMessage, and (2) the MailChannel was not properly initialized due to missing markdownResolver (ChannelManager does not call markdownResolver on the MailChannel.
This is definitely not a bug, but could be a pitfall for someone like me to fall into.
The text was updated successfully, but these errors were encountered:
Description:
This is about MailChannel on Notifications.
In the documentation, it does mention that to use mail channel, we should return
['mail']
in thevia
method. So because I have two other custom channels, I did this at first:Then because of OCD, I changed it to:
And very soon, I received this error:
Apparently, what happened here is MailChannel (line 69) is expecting MailMessage to provide a view, if not, provide a markdownResolver, but neither of these can be fulfilled because (1) MailMessage does not need to define a view, and (2) markdownResolver is not set from ChannelManager, in line 90, because it sorts of skipped when I use
MailChannel::class
.Steps To Reproduce:
Create a new Notification called
TestNotification.php
underapp/Notifications/
:Use any notifiable model, and notify with this notification:
This would result in an error as (1) view is not defined in
MailMessage
, and (2) theMailChannel
was not properly initialized due to missingmarkdownResolver
(ChannelManager
does not callmarkdownResolver
on theMailChannel
.This is definitely not a bug, but could be a pitfall for someone like me to fall into.
The text was updated successfully, but these errors were encountered: