/** * Updates an existing Partner model. * If update is successful, the browser will be redirected to the 'view' page. * @param integer $id * @return mixed */ public function actionUpdate($id, $section = 'one') { $model = $this->findModel($id); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['index']); } else { $category = new Category(); $service = new Service(); $service->parentId = $model->id; $serviceDataProvider = $service->search(Yii::$app->request->queryParams); return $this->render('update', ['model' => $model, 'category' => $category, 'service' => $service, 'serviceDataProvider' => $serviceDataProvider, 'section' => $section]); } }
public function actionSearch($q) { $this->layout = '//default'; $model = new Service(); $items = $model->search(['Service' => ['title' => $q]]); return $this->render('search', ['items' => $items, 'q' => $q]); }