/** * 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]); } }
/** * 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]); } }
/** * 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]); } }
/** * 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]); } }