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