clockwork
clockwork copied to clipboard
ErrorException Attempt to read property "subject" on null LaravelNotificationsDataSource.php:177
I have this code below that I use to send multiple notifications to agents which works fine without clockwork being enabled but as soon as I enable clockwork the code fails with this error ErrorException Attempt to read property "subject" on null LaravelNotificationsDataSource.php:177
I'm not sending email notification, it's a database notification.
$cardTrade = App\Models\CardTrade::with(['card_code.card', 'handler', 'submitted_by', 'history'])
->findOrFail($card_trade_id);
$amount = $cardTrade->getProcessedAmount();
$agents = App\Models\User::where('account_type', 'AG')->get();
Illuminate\Support\Facades\Notification::send($agents, new App\Notifications\TradeAction(
"IncomingNewCardTrade",
"User requested to trade {$amount->formatted} {$cardTrade->getCardName()} card.",
$cardTrade
));
having the same issue as well
Have a very similar issue. The issue seems to be an assumption that defining a toMail method on the notification is reason enough to run that method. Some notifications may be used for different notifiable's that don't support every method.
The correct way that this should work is in resolveChannelSpecific to inspect the incoming $event which has a 'channel' property - rather than using the method existence.
This bug is impactful enough that we won't be able to use Clockwork unfortunately.
This is now fixed in master and will be released soon, thanks for the suggestion @jameshulse.
Well, when I've said soon, I've lied. :) But this is finally fixed in Clockwork 5.2.