Hey, it's me again.
I was working on sending notifications and suddenly I started getting the error in the image attached to the post. I have absolutely no idea on what is causing this. This is happening when I send a Laravel notification.
Check my toArray() function in the notification class:
public function toArray($notifiable)
{
return [
'title' => $this->title,
'content' => $this->content
];
}
There is nothing wrong with this. Everything is fine. The constructor set this private variables using property promotion and I am passing it when instantiating the notification class.
The only thing I think might be causing the issue is I have a replacement for the database channel which is a channel named DatabaseChannel and extends Illuminate's default one:
class DatabaseChannel extends IlluminateDatabaseChannel
{
public function buildPayload($notifiable, Notification $notification)
{
return [
'id' => $notification->id,
'type' => get_class($notification),
'data' => $this->getData($notifiable, $notification),
'read_at' => null,
'sender_id' => $notification->getSenderID()
];
}
}
So far I have debugged and all variables, everything sent there is completely fine. I just don't get it why this error keeps showing up and I can't even find what is causing it or where it is happening.
Any thoughts? If you need any more information, I'll be glad to send it.