/** * Remove / delete an activity from the Notification for the user * @param Notification $notification * @param string $activity * @param UserInterface $user * @return bool */ public function removeActivity(Notification $notification, $activity, UserInterface $user) { try { /** * using index */ $user_activity = $notification->activities()->where('user_id', $user->getAuthIdentifier())->where('activity', $activity)->firstOrFail(); if ($user_activity->delete()) { return true; } return false; } catch (\Exception $e) { return false; } }
/** * Do the delete-Action * @return Response */ public function delete() { $this->model->delete(); }