protected function getUnreadNotifications() { static $cached = null; if (is_null($cached)) { $cached = $this->notifications()->whereIn('type', $this->getAlertableNotificationTypes())->where('is_read', 0)->where('is_deleted', 0)->get(); } return $cached; }