Пример #1
0
 /**
  * Updates an existing Cosechadia model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param string $id
  * @return mixed
  */
 public function actionUpdate($id)
 {
     $empleados = EmpleadoSearch::find()->all();
     $data = array();
     $model = $this->findModel($id);
     foreach ($empleados as $empleado) {
         $data[$empleado->empleado_id] = $empleado->nombre . ' ' . $empleado->apellido;
     }
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->cosechadia_id]);
     } else {
         return $this->render('update', ['model' => $model, 'data' => $data]);
     }
 }