/** * Store a newly created resource in storage. * * @return Response */ public function store() { $sala = new Sala(); $sala->nombre = Request::get('nombre'); $sala->butacas = Request::get('butacas'); $sala->funcionarioId = Auth::user()->id; $sala->localId = Request::get('localId'); $sala->save(); return Response::json(array('error' => false, 'salas' => $sala->toArray()), 200); }
/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new Sala(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['Sala'])) { $model->attributes = $_POST['Sala']; if ($model->save()) { $this->redirect(array('view', 'id' => $model->id)); } } $this->render('create', array('model' => $model)); }