/** * Store a newly created Speciality in storage. * * @return Response */ public function store() { $data = Input::all(); $Speciality = new Speciality(); if (!$Speciality->isValid($data)) { return Response::json(array('status' => false, 'dataError' => $Speciality->getListErrors()), 500); } $Speciality->name = $data['speciality']; $Speciality->save(); return Response::json(array('status' => true)); }
/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new Speciality(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['Speciality'])) { $model->attributes = $_POST['Speciality']; if ($model->save()) { $this->redirect(array('view', 'id' => $model->id)); } } $this->render('create', array('model' => $model)); }