Ejemplo n.º 1
0
 /**
  * Creates a new Aluno model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Aluno();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->codigo]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
Ejemplo n.º 2
0
 /**
  * Creates a new Aluno model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Aluno();
     $arraycursos = Curso::find()->all();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('create', ['model' => $model, 'cursos' => $arraycursos]);
     }
 }
Ejemplo n.º 3
0
 /**
  * Creates a new Aluno model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Aluno();
     $arrayDeCurso = ArrayHelper::map(CursoSearch::find()->all(), 'ID', 'nome');
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->ID]);
     } else {
         return $this->render('create', ['model' => $model, 'arrayDeCurso' => $arrayDeCurso]);
     }
 }
Ejemplo n.º 4
0
 /**
  * Creates a new Aluno model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Aluno();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         Yii::$app->session->setFlash('success', 'Aluno cadastrado com sucesso!');
         //return $this->redirect(['view', 'id' => $model->codigo]);
         return $this->redirect(['index']);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }