Exemplo n.º 1
0
 /**
  * Updates an existing Example model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id
  * @return mixed
  */
 public function actionUpdate($id)
 {
     $model = $this->findModel($id);
     $model->attributes = array('service' => ExampleService::getExampleServices($id));
     // Получаем список услуг компании
     $services = Service::getAllServices();
     $post = Yii::$app->request->post();
     //print_r();
     if ($model->load(Yii::$app->request->post()) && $model->save(false)) {
         ExampleService::saveExampleServices($id, $post['Example']['service']);
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('update', ['model' => $model]);
     }
 }