public function postGuardardepartamento()
 {
     $city = new Ciudad();
     $city->departamento = Request::input('departamento');
     $city->pais_id = Request::input('pais')['id'];
     $city->save();
     return $city;
 }
Exemplo n.º 2
0
 /**
  * Creates a new Ciudad model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Ciudad();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
Exemplo n.º 3
0
 public function store()
 {
     try {
         $ciudad = new Ciudad();
         $ciudad->ciudad = Request::input('ciudad');
         $ciudad->departamento = Request::input('departamento');
         $ciudad->pais_id = Request::input('pais_id');
         $ciudad->save();
         return $ciudad;
     } catch (Exception $e) {
         return $e;
     }
 }