code: public function hasNotifications($type = null)
      {
          if (null !== $type) {
              NotificationTypes::isValidType($type);
  
              return $this->getNotifications($type)->count();
          }
  
          return 0 < $this->notifications->count();
      }
docs: Returns whether the notifiable has notifications or not, optionally filtered by type.
  
  @param string $type
  
  @return bool