toDatabaseOptional($notifiable)) ? $data : [$data]; } } /** * Build an array payload for the DatabaseNotification Model. * * @param mixed $notifiable * @param \Illuminate\Notifications\Notification $notification * @return array */ protected function buildPayload($notifiable, Notification $notification) { return [ 'id' => $notification->id, 'type' => get_class($notification), 'data' => $this->getData($notifiable, $notification), 'read_at' => null, ] + $this->getOptionalData($notifiable, $notification); } }