Skip to content

Instantly share code, notes, and snippets.

@alouini333
Created January 19, 2020 16:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save alouini333/28ec4214c08887660f3a2f187db5d39e to your computer and use it in GitHub Desktop.
Save alouini333/28ec4214c08887660f3a2f187db5d39e to your computer and use it in GitHub Desktop.
<?php
namespace App\Channels;
use Illuminate\Notifications\Channels\DatabaseChannel as IlluminateDatabaseChannel;
use Illuminate\Notifications\Notification;
class DatabaseChannel extends IlluminateDatabaseChannel
{
/**
* Send the given notification.
*
* @param mixed $notifiable
* @param \Illuminate\Notifications\Notification $notification
*
* @return \Illuminate\Database\Eloquent\Model
*/
public function buildPayload($notifiable, Notification $notification)
{
return [
'id' => $notification->id,
'type' => get_class($notification),
'data' => $this->getData($notifiable, $notification),
'read_at' => null,
'tenant_id' => $notification->getTenant()->id
];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment