예제 #1
0
 /**
  * Store a newly created resource in storage.
  *
  * @param Request $request
  * @return Response
  */
 public function store(Request $request)
 {
     //
     $room_type = new RoomType($request->all());
     $room_type->save();
     return $room_type;
 }
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new RoomType();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['RoomType'])) {
         $model->attributes = $_POST['RoomType'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model));
 }
 public function testUpdate()
 {
     $this->resetRoomTypesTable();
     $roomType = new RoomType();
     $roomType->setAttributes(array('description' => 'Double Room', 'quantity' => 2));
     $this->testAdd();
     $roomType->setAttribute('description', 'Tripple Room');
     $roomType->save();
     $criteria = new CDbCriteria();
     $criteria->condition = 'description=:description';
     $criteria->params = array(':description' => 'Tripple Room');
     $roomType = RoomType::model()->find($criteria);
     $this->assertNotNull($roomType);
 }
예제 #4
0
			die(header('Location: ' . DOMAIN . 'dashboard/add-hotel/step-04'));
		}else  */
		if(!isset($_POST['room']) || (count(array_filter($_POST['room'])) < 1)){
			die(header('Location: ' . $_SESSION['page_url']));
		}
		$room = $_POST['room'];
		$rType = $room['type'];
		$rFIds = implode(',', $room['feature']);
		$rQty = $room['qty'];
		$rQtyAssigned = $room['qtyAssigned'];
		$rMaxPersons = $room['maxPersons'];
		$rMaxExtraBeds = $room['maxExtraBeds'];

		$rTypeObj = new RoomType();
		$rTypeObj->name = $rType;
		$rTypeObj->save();

		$rObj = new Room();
		$rObj->room_type_id = $rTypeObj->id;
		$rObj->room_feature_ids = $rFIds;
		$rObj->no_of_rooms = $rQty;
		$rObj->assigned_rooms = $rQtyAssigned;
		$rObj->max_persons = $rMaxPersons;
		$rObj->max_extra_beds = $rMaxExtraBeds;
		$rObj->hotel_id = $hotel_id;
		$rObj->save();

		$roomImages = $_FILES['roomImg'];
		$images = $roomImages['name'];
		$prefix = hash('md5', $hotel_id) . '_' . hash('md5', $rObj->id) . '_';
		$uploadDir = DOC_ROOT . 'uploads/room-photos/';
예제 #5
0
 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function create()
 {
     $room_type = new RoomType($request->all());
     $room_type->save();
     return $room_type;
 }