public function actionCreate() { $model = new Rooms(); if (isset($_POST['Rooms'])) { $model->attributes = $_POST['Rooms']; if ($model->save()) { $this->redirect('/rooms/'); } } $this->render('create', array('model' => $model)); }
/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new Rooms(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['Rooms'])) { $model->attributes = $_POST['Rooms']; if ($model->save()) { $this->redirect(array('admin', 'id' => $model->idtbl_room)); } } $this->render('create', array('model' => $model)); }
/** * Store a newly created resource in storage. * * @return Response */ public function store() { $validator = Validator::make($data = Input::all(), Rooms::$rules); if ($validator->fails()) { return Redirect::back()->withErrors($validator)->withInput(); } $room = new Rooms(); $room->room_location = Input::get('roomlocation'); // $room->save(); $room->room_no = Input::get('roomno'); // $room->save(); $room->room_type = Input::get('roomtype'); $room->status = 'active'; $room->save(); return Redirect::route('rooms.index'); }