/** @param int $pageSeoId */ public static function registerSeo($pageSeoId) { $model = PageSeo::find()->andWhere(['id' => $pageSeoId])->one(); if ($model) { MetaTagRegister::register($model); } }
public function actionView($alias) { /** @var Article $model */ $model = Article::find()->from(['t' => Article::tableName()])->joinWith(['titleImage', 'category'])->andWhere(['t.alias' => $alias, 't.published' => 1])->one(); if (!$model) { throw new NotFoundHttpException(\Yii::t('app', 'Page not found')); } $model->views = $model->views + 1; $model->save(false); MetaTagRegister::register($model); if (\Yii::$app->request->isAjax) { return $this->renderAjax('view', ['model' => $model]); } return $this->render('view', ['model' => $model]); }