toDatabase($notifiable); $document_id = $data['workflow_document_id']; unset($data['workflow_document_id']); \App\Notification::where('notifiable_id', $notifiable->id)->where('workflow_document_id', $document_id)->whereNull('read_at')->update(['read_at'=>now()->format('Y-m-d H:i:s')]); return $notifiable->routeNotificationFor('database')->create([ 'id' => $notification->id, 'workflow_document_id'=> $document_id, 'notifiable_type' => $notifiable->user_id, 'type' => get_class($notification), 'data' => $data, ]); } }