if ($post) { $category_slug = \Yii::$app->VCache->type('common')->slugCategory(); if (array_search($post, $category_slug) !== false) { return $this->redirect('/' . $post, 302); } } $post = Post::find()->andWhere(['slug' => $post])->with(['category', 'tags'])->one(); $post->views = $post->views+1; $post->update(); if (!$post) { throw new NotFoundHttpException(); } return $this->render('index', ['post' => $post]); }
$_GET = [ 'category' => 'istoria', 'post' => 'istoriceskaa-spravka-celi-i-zadaci-ano-nasledie-otecestva', ];