public function createNotification($event) { $type = get_class($event['object']); $id = $event['object']->id; $name = $event['name']; $exist = Notification::where('object_id', '=', $id)->where('object_type', '=', $type)->where('event', '=', $name)->first(); $notification = Notification::create(['object_type' => $type, 'object_id' => $id, 'event' => $name]); $notification->save(); if ($exist == NULL) { if (!$notification->id) { dd("Error Saving Notification", $notification); } } return $notification; }