diff --git a/frontend/controllers/ServiceController.php b/frontend/controllers/ServiceController.php index 08cac89..2d76415 100644 --- a/frontend/controllers/ServiceController.php +++ b/frontend/controllers/ServiceController.php @@ -19,11 +19,11 @@ public function actionView($id){ $model = $this->findModel($id); if ($model->parent_id == null){ - $others = Service::find()->where(['parent_id' => $model->id])->with('services')->all(); + $others = Service::find()->where(['parent_id' => $model->id])->with('services.language.alias')->all(); }elseif ($model->level == 1){ - $others = Service::find()->where(['parent_id' => $model->parent_id])->with('services')->all(); + $others = Service::find()->where(['parent_id' => $model->parent_id])->with('services.language.alias')->all(); }else{ - $others = Service::find()->where(['parent_id' => (new Query())->select('parent_id')->from('service')->where(['id' => $model->parent_id])])->with('services')->all(); + $others = Service::find()->where(['parent_id' => (new Query())->select('parent_id')->from('services.language.alias')->where(['id' => $model->parent_id])])->with('services.language.alias')->all(); } $model->body = str_replace('[[prices]]', $this->renderPartial('_prices', ['prices' => $model->prices]), $model->body); @@ -36,12 +36,12 @@ public function findModel($id){ $model = Service::find() ->where(['id' => $id, 'status' => true]) - ->with(['language.alias', 'image', 'prices' => function (ActiveQuery $query){ + ->with(['language.alias', 'prices' => function (ActiveQuery $query){ $query->where(['status' => true])->orderBy('sort'); }, 'comments' => function (ActiveQuery $query){ $query->where(['status' => true]); }, 'questions' => function (ActiveQuery $query){ - $query->where(['status' => true]); + $query->where(['status' => true])->with('doctor'); }])->one(); if (empty($model)){ throw new NotFoundHttpException('Model not found'); diff --git a/frontend/controllers/SiteController.php b/frontend/controllers/SiteController.php index 4b9d403..423a4c5 100755 --- a/frontend/controllers/SiteController.php +++ b/frontend/controllers/SiteController.php @@ -57,7 +57,7 @@ */ public function actionIndex() { - $slides = Slide::find()->with('language')->where(['status' => true])->orderBy('sort')->all(); + $slides = Slide::find()->with('language')->where(['status' => true])->orderBy('sort')->with('language.image')->all(); $services = Service::find()->where(['is not' ,'image_id', NULL])->andWhere( [ 'status' => true, @@ -66,6 +66,7 @@ ) ->with( [ + 'image', 'language.alias', 'services' => function (ActiveQuery $query) { $query->where(['status' => true])->with(['language.alias']); diff --git a/frontend/views/layouts/main.php b/frontend/views/layouts/main.php index ddfb131..e2994dc 100755 --- a/frontend/views/layouts/main.php +++ b/frontend/views/layouts/main.php @@ -160,7 +160,7 @@ } $items[] = [ 'label' => $service->title, - 'url' => Url::to([ 'alias' => $service->alias ]), + 'url' => Url::to([ 'alias' => $service->language->alias ]), ]; } $items[] = [ @@ -198,13 +198,13 @@ foreach ($service->services as $item) { $servicesChild[] = [ 'label' => $item->title, - 'url' => Url::to([ 'alias' => $item->alias ]), + 'url' => Url::to([ 'alias' => $item->language->alias ]), ]; } $itemsMobile[] = [ 'label' => $service->title, 'items' => $servicesChild, - 'url' => Url::to([ 'alias' => $service->alias ]), + 'url' => Url::to([ 'alias' => $service->language->alias ]), ]; } $itemsMobile[] = [ diff --git a/frontend/views/service/view.php b/frontend/views/service/view.php index 82d284e..6c481be 100644 --- a/frontend/views/service/view.php +++ b/frontend/views/service/view.php @@ -28,12 +28,12 @@