search(\Yii::$app->request->queryParams); $dataProvider->pagination = [ 'pageSize' => 10, ]; $dataProvider->query->with('images'); return $this->render('index', [ 'searchModel' => $searchModel, 'dataProvider' => $dataProvider, ]); } public function actionView($id) { $model = $this->findModel($id); return $this->render('view', [ 'model' => $model, ]); } private function findModel($id) { $model = Project::findOne($id); if(empty( $model )) { throw new NotFoundHttpException(); } return $model; } }