findModel($id); if(!$model instanceof News) throw new NotFoundHttpException("Новость не найдена"); return $this->render('view',['model'=>$model]); } public function actionStoryslugView($storyslug):string { $model = News::find()->andWhere(['alias'=>$storyslug])->one(); if(!$model instanceof News) throw new NotFoundHttpException("Новость не найдена"); return $this->render('view',['model'=>$model]); } private function findModel($id) { return News::find()->andWhere(['id'=>$id])->one(); } }