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
Laravel's notifications data formats for broadcast driver and database driver are different. This causes an error when a notification is broadcasted. But after a refresh user can load the same notification and it works just fine (because this time it's being fetched from database).
The production server however is working fine now and that's because back then I used to push /vendor files and in my local vendors files I've done this modification in Laravel core that takes care of it:
In BroadcastNotificationCreated.php:
/** * Get the data that should be sent with the broadcasted event. * * @return array */publicfunctionbroadcastWith()
{
return [
'data' => $this->data,
'id' => $this->notification->id,
'type' => get_class($this->notification),
'created_at' => Carbon::now(),
'read_at' => null
];
// return array_merge($this->data, [// 'id' => $this->notification->id,// 'type' => get_class($this->notification),// ]);
}
Can you think of a "right way" for this?
The text was updated successfully, but these errors were encountered:
From @sullyfischer's comment:
The text was updated successfully, but these errors were encountered: