/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new Secciones(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['Secciones'])) { $model->attributes = $_POST['Secciones']; if ($model->save()) { $this->redirect(array('view', 'id' => $model->idSeccion)); } } $this->render('create', array('model' => $model)); }
public function nuevaSeccion($inputs) { $fecha = new DateTime(); DB::transaction(function () use($inputs, $fecha) { $section = new Secciones(); $section->NombreSeccion = $inputs['new-nombre']; $section->FechaCreacion = $fecha->format('Y-m-d'); $section->FechaEdicion = $fecha->format('Y-m-d'); $section->CreadoPor = Auth::User()->IdUsuario; $section->EditadoPor = Auth::User()->IdUsuario; $section->save(); }); $Id = DB::table('secciones')->max('IdSeccion'); return $Id; }