Esempio n. 1
0
 /**
  * Creates a new Empleado model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Empleado();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
Esempio n. 2
0
 public function actionSignup()
 {
     if (Yii::$app->user->identity->username == "zama") {
         $model = new SignupForm();
         $empleado = new Empleado();
         if ($model->load(Yii::$app->request->post()) && $empleado->load(Yii::$app->request->post())) {
             $empleado->estatus_did = 1;
             if ($empleado->validate() && $model->validate()) {
                 $empleado->save();
                 $model->empleado_did = $empleado->id;
                 if ($user = $model->signup()) {
                     if (Yii::$app->getUser()->login($user)) {
                         return $this->goHome();
                     }
                 }
             }
         }
         return $this->render('signup', ['model' => $model, 'empleado' => $empleado]);
     } else {
         return $this->goHome();
     }
 }