📜  Laravel:自定义或扩展通知 - 数据库模型 - PHP 代码示例

📅  最后修改于: 2022-03-11 14:54:09.643000             🧑  作者: Mango

代码示例2
# Laravel 6/7
# Go to the vendor/laravel/framework/src/Illuminate/Notifications/Channels/DatabaseChannel.php

protected function buildPayload($notifiable, Notification $notification)
    {

        $_getData = $this->getData($notifiable, $notification);

        return [
            'id'         => $notification->id,
            'type'       => get_class($notification),
            'data'       => $this->getData($notifiable, $notification),
            'event_id'   => $_getData['model_id'],
            'event_type' => $_getData['event_type'],
            'read_at'    => null,
        ];
    }