private function findModel($slug) { $model = News::findOne(['slug' => $slug]); if (!$model) { throw new NotFoundHttpException('News was not found.'); } return $model; }