Forum\Notification\Notification::getNotification PHP Method

getNotification() public static method

getNotification
public static getNotification ( string $type, integer $targetId, integer $userId ) : mixed | Windwalker\Data\Data
$type string
$targetId integer
$userId integer
return mixed | Windwalker\Data\Data
    public static function getNotification($type, $targetId, $userId)
    {
        $mapper = new NotificationMapper();
        return $mapper->findOne(['user_id' => $userId, 'target_id' => $targetId, 'type' => $type]);
    }

Usage Example

Beispiel #1
0
 /**
  * prepareData
  *
  * @param \Windwalker\Data\Data $data
  *
  * @return  void
  */
 protected function prepareData($data)
 {
     $paths = $data->currentCategory->path;
     $data->breadcrumbs = BreadcrumbHelper::getBreadcrumbs($paths);
     if ($data->currentCategory->id != 1) {
         $this->setTitle($data->currentCategory->title);
     }
     // Prepare format
     foreach ($data->categories as $category) {
         $category->last_post->user_params = new Registry($category->last_post->user_params);
     }
     foreach ($data->topics as $topic) {
         $topic->last_user_params = new Registry($topic->last_user_params);
     }
     $user = User::get();
     $data->isWatch = Notification::getNotification('category', $data->currentCategory->id, $user->id)->notNull();
     if ($data->currentCategory->id != 1) {
         $desc = $data->currentCategory->description;
         $desc = Utf8String::substr(strip_tags($desc), 0, 150);
         HtmlHeader::addMetadata('description', $desc, true);
         HtmlHeader::addOpenGraph('og:title', HtmlHeader::getPageTitle(), true);
         HtmlHeader::addOpenGraph('og:description', $desc, true);
         HtmlHeader::addOpenGraph('og:image', $data->currentCategory->image, true);
     }
 }
All Usage Examples Of Forum\Notification\Notification::getNotification