/**
  * @param $icon
  * @param $text
  * @param null $url
  * @param null $user_id
  * @return bool
  */
 public static function push($icon, $text, $url = null, $user_id = null)
 {
     $user_id = !$user_id ? Yii::$app->user->getId() : $user_id;
     $notification = new Notifier();
     $notification->user_id = $user_id;
     $notification->is_viewed = self::NOT_VIEWED;
     $notification->icon = $icon;
     $notification->text = $text;
     $notification->url = $url;
     $notification->created = date("Y-m-d H:i:s");
     return $notification->save();
 }
 public function run()
 {
     $notifications = Notifier::get_notifications(\Yii::$app->user->getId());
     $this->register();
     return $this->render('notification', ['notifications' => $notifications, 'count' => count($notifications)]);
 }
 public function actionIndex()
 {
     return Notifier::get_notifications(Yii::$app->user->getId());
 }