/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new Evaluacion(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['Evaluacion'])) { $model->attributes = $_POST['Evaluacion']; if ($model->save()) { $this->redirect(array('view', 'id' => $model->EVA_ID)); } } $this->render('create', array('model' => $model)); }
/** * Store a newly created resource in storage. * * @return Response */ public function store() { // Creamos un nuevo objeto para nuestro nuevo materia $evaluacion = new Evaluacion(); // Obtenemos la data enviada por el materia $data = Input::all(); // Revisamos si la data es válido if ($evaluacion->isValid($data)) { // Si la data es valida se la asignamos al materia $evaluacion->fill($data); // Guardamos el materia $evaluacion->save(); // Y Devolvemos una redirección a la acción show para mostrar el materia //return Redirect::route('evaluacion.show', array($evaluacion->id)); return Redirect::route('crear-curso-7', array($data['id_curso'])); } else { // En caso de error regresa a la acción create con los datos y los errores encontrados //return Redirect::route('evaluacion.create')->withInput()->withErrors($evaluacion->errors); } }