/** * Lists all Services models. * @return mixed */ public function actionIndex($id = 0) { if ($id == 0) { $count = 1; } else { $count = Services::find()->where(['id' => $id, 'type' => 'catalog'])->count(); } if ($count != 0) { $searchModel = new ServicesSearch(); $dataProvider = $searchModel->search2(Yii::$app->request->queryParams, $id); $Services = Services::getParentID($id); return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider, 'id' => $id, 'Services' => $Services]); } else { throw new NotFoundHttpException(Yii::t('app', 'The requested page does not exist.')); } }