/** * Lists all Notification models. * @return mixed */ public function actionIndex() { $dataProvider = new ActiveDataProvider(['query' => Notification::find()->where(['user_id' => Yii::$app->user->id]), 'sort' => ['defaultOrder' => ['created_at' => SORT_DESC, 'id' => SORT_ASC]]]); $notifyCount = UserService::findNotifyCount(); UserService::clearNotifyCount(); return $this->render('index', ['dataProvider' => $dataProvider, 'notifyCount' => $notifyCount]); }
public function run() { $notifyCount = UserService::findNotifyCount(); return $this->render('nav', ['notifyCount' => $notifyCount]); }