/** * Run the database seeds. * * @return void */ public function run() { // Model::unguard(); //create a user $user = new User(); $user->email = "*****@*****.**"; $user->password = Hash::make('password'); $user->save(); //create a country $country = new Country(); $country->name = "United States"; $country->id = 236; $country->save(); //create a state $state = new State(); $state->name = "Pennsylvania"; $state->id = 1; $state->save(); $city = new City(); $city->name = "Pittsburgh"; $city->id = 1; $city->save(); //create a location $location = new Location(); $location->city_id = $city->id; $location->state_id = $state->id; $location->country_id = $country->id; $location->latitude = 40.44; $location->longitude = 80; $location->code = '15212'; $location->address_1 = "100 Main Street"; $location->save(); //create a new accommodation $accommodation = new Accommodation(); $accommodation->name = "Royal Plaza Hotel"; $accommodation->location_id = $location->id; // $location->id; $accommodation->description = "A modern, 4-star hotel"; $accommodation->save(); //create a room $room1 = new App\Room(); $room1->id = 1; $room1->room_number = 'A01'; $room1->accommodation_id = $accommodation->id; $room1->save(); //create another room $room2 = new Room(); $room2->id = 2; $room2->room_number = 'A02'; $room2->accommodation_id = $accommodation->id; $room2->save(); //create the room array $rooms = [$room1, $room2]; //$this->call('AuthorsTableSeeder'); //$this->command->info('Authors table seeded!'); // $this->call(AmenityTableSeeder::class); $this->command->info('Amenity Class Seeded table seeded!'); }
/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) { $room = new Room(); $room->number = $request->number; $room->capacity = $request->capacity; $room->room_type_id = $request->room_type_id; $room->save(); }
public static function postCreate($request, $category) { foreach ((array) $request->get('name') as $room) { $new_room = new Room(); $new_room->category_id = $category->id; $new_room->name = $room; $new_room->save(); } return redirect()->back()->with('message', 'Room was successfully created.'); }
public function saveRoom(Request $request) { $room = new Room(); //if(!$request->input('number')) // return response()->json($this->failureMessage); $room->number = $request->input('number'); $room->capacity = $request->input('capacity'); $room->save(); return response()->json($room); }
/** * Run the database seeds. * * @return void */ public function run() { $faker = Faker::create(); for ($i = 1; $i <= 20; $i++) { $room = new Room(); $room->number = $i; $room->capacity = $faker->biasedNumberBetween($min = 1, $max = 4, $function = 'sqrt'); $room->room_type_id = $faker->biasedNumberBetween($min = 1, $max = 3, $function = 'sqrt'); $room->save(); } }
public function store_room(Request $request) { $base_id = $request->base_id; $name = $request->name; $url = "manage/bases/" . $base_id; $room = new Room(); $room->name = $name; $room->base_id = $base_id; $room->save(); return redirect($url); }
/** * Store a newly created resource in storage. * * @return Response */ public function store($property_id) { // $room = new Room(); $room->property_id = $property_id; $room->room_type_id = Input::get('type_id'); $room->name = Input::get('name'); $room->description = Input::get('description'); $room->is_published = Input::get('is_approved') == 'on' ? TRUE : FALSE; $room->save(); return Redirect::to('room/facilities/' . $property_id . "/create"); }
/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request, $buildingId) { // $this->validate($request, ['name' => 'required|max:255', 'room_sn' => 'required|max:255', 'water_degree' => 'required|numeric', 'electric_degree' => 'required|numeric'], ['required' => 'The :attribute field is required', 'numeric' => 'The :attribute field must be numeric', 'max' => 'The length of :attribute can not bigger than 255']); $room = new Room($request->all()); $room->building_id = $buildingId; $room['user_id'] = $this->user['id']; if (!$room->save()) { abort(500, 'Could not save room'); } return $room; }
/** * Store a newly created resource in storage. * * @return Response */ public function store() { // $v = Validator::make(Request::all(), ['name' => 'required|max:50|unique:rooms', 'spot_id' => 'required', 'event_id' => 'required']); if ($v->fails()) { return redirect()->back()->withErrors($v->errors())->withInput(); } else { $room = new Room(); $room->name = Request::get('name'); $room->desc = Request::get('desc'); $room->spot_id = Request::get('spot_id'); $room->event_id = Request::get('event_id'); $room->save(); return redirect('rooms'); } }
public function store() { $request = json_decode(request()->getContent()); $rules = array('name' => 'required|unique:rooms', 'capacity' => 'required'); $validation = Validator::make((array) $request, $rules); if ($validation->fails()) { return response()->json(array('error' => true, 'message' => $validation->errors()->all(), 200)); } $room = new Room(); $room->name = $request->name; $room->capacity = abs($request->capacity); $room->status = 0; $saved = $room->save(); if ($saved) { return response()->json(array('error' => false, 'rooms' => $room->toArray()), 200); } }
/** * Store a newly created resource in storage. * * @return Response */ public function store() { // $all_rooms = DB::table('rooms')->lists('name'); $input = Input::all(); $user_id = Auth::user()->id; $validator = Validator::make($input, ['name' => 'required|unique:rooms,name']); $name = $input['name']; if (!$name || !$user_id) { return; } if ($validator->passes()) { $privacy = $input['status']; $slug = str_replace(array(' ', ';'), '-', strtolower($name)); $room = new Room(); $room->name = $name; $room->slug = $slug; $room->user_id = $user_id; $room->status = $privacy; $room->save(); return redirect('/room'); } return back()->withInput()->withErrors($validator->messages()); }
/** * Store a newly created resource in storage. * * @return Response */ public function store(Request $request) { //make validations $validator = Validator::make($request->all(), ['name' => 'required', 'email' => 'array']); $validator->each('email', ['email']); if ($validator->fails()) { return redirect('room/create')->withErrors($validator)->withInput()->with('validation_err', true); } $room = new Room(); $room->name = $request->input('name'); $room->recording = empty($request->input('recording')) ? 0 : 1; $room->public = empty($request->input('public')) ? 0 : 1; $room->att_pass = Str::quickRandom(8); $room->mod_pass = Str::quickRandom(8); //add owner $user = Auth::User(); $room->owner = $user->id; //check if meeting id exists \DB::transaction(function () use($room) { //check for unique access_pin and meeting id do { $bbb_meeting_id = Str::quickRandom(8); } while (Room::where('bbb_meeting_id', '=', $bbb_meeting_id)->count() != 0); do { $access_pin = mt_rand(0, 999999); } while (Room::where('access_pin', '=', $access_pin)->count() != 0); $room->bbb_meeting_id = $bbb_meeting_id; $room->access_pin = $access_pin; $room->save(); }); //extract emails /*$mails = preg_split('/\r\n|\n|\r/', $request->input('participants')); $part_mails = array(); foreach($mails as $mail){ $part_mail = filter_var($mail, FILTER_VALIDATE_EMAIL); if($part_mail){ $participant = new Participant(); $participant->mail = $part_mail; $participant->room_id = $room->id; $participant->save(); } }*/ $emails = $request->input('email'); $moderators = $request->input('moderator'); if (!$moderators) { $moderators = array(); } if (is_array($emails)) { foreach ($emails as $email) { $participant = new Participant(); $participant->mail = $email; $participant->room_id = $room->id; if (in_array($email, $moderators)) { $participant->moderator = 1; } $participant->save(); } } return Redirect::action('roomController@own'); }
public function PostRoomNumberView() { $roomnum = Input::get('rnumber'); $roomnocheck = Room::where('institute_code', '=', Auth::user()->institute_id)->where('room_no', '=', $roomnum)->count(); if ($roomnocheck == 1) { Session::flash('warn', 'This Room already allocated for another class Please Try another !'); return Redirect::to('add/room/number'); } else { $iid = Institute::where('institute_code', '=', Auth::user()->institute_id)->pluck('institute_code'); // /return $iid; $radd = new Room(); $radd->institute_code = $iid; $radd->room_name = Input::get('rname'); $radd->room_no = Input::get('rnumber'); $radd->note = Input::get('note'); $radd->save(); Session::flash('data', 'Data successfully added !'); return Redirect::to('add/room/number'); } }
/** * add room to the system * * @param Request $request * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View */ public function room_add(Request $request) { $room = new Room(); $room->room_num = $request->input('rnum'); $room->room_size = $request->input('rsize'); $room->sequence_num = $request->input('max'); $room->room_type_id = $request->input('rtype'); $room->status = $request->input('rstatus'); $room->remarks = $request->input('rremarks'); $room->save(); }
public function createRooms() { if (Auth::admin()->check()) { $roomname = Request::get('roomRegisterName'); $roomtype = Request::get('roomRegisterType'); $roomcapacity = Request::get('roomRegisterCapacity'); $roomrate = Request::get('roomRegisterRate'); $roomstatus = Request::get('roomRegisterStatus'); $roomdescription = Request::get('roomRegisterDescription'); $room = new Room(); $room->RoomName = $roomname; $room->RoomType = $roomtype; $room->RoomCapacity = $roomcapacity; $room->RoomRate = $roomrate; $room->RoomStatus = $roomstatus; $room->RoomDescription = $roomdescription; $room->save(); Session::flash('flash_message', 'Room successfully added!'); return redirect('/auth/databaseroom'); } else { return redirect()->back(); } }
/** * Run the database seeds. * * @return void */ public function run() { DB::table('room_types')->truncate(); DB::table('rooms')->truncate(); $room_type = new RoomType(); $room_type->name = "Standard Room A"; $room_type->description = "(2-3 persons) w/o balcony"; $room_type->rate = 2800; $room_type->save(); $room_type = new RoomType(); $room_type->name = "Standard Room A"; $room_type->description = "(2-3 persons) w/ balcony"; $room_type->rate = 3200; $room_type->save(); $room_type = new RoomType(); $room_type->name = "Standard Room B"; $room_type->description = "(4-5 persons)"; $room_type->rate = 3200; $room_type->save(); $room_type = new RoomType(); $room_type->name = "Deluxe Room"; $room_type->description = "(4-5 persons)"; $room_type->rate = 3700; $room_type->save(); $room_type = new RoomType(); $room_type->name = "Family Room A"; $room_type->description = "(6 persons)"; $room_type->rate = 4200; $room_type->save(); $room_type = new RoomType(); $room_type->name = "Family Room B"; $room_type->description = "(7 persons)"; $room_type->rate = 4800; $room_type->save(); $room_type = new RoomType(); $room_type->name = "Suite Room"; $room_type->description = "(1-2 persons)"; $room_type->rate = 4000; $room_type->save(); $room_type = new RoomType(); $room_type->name = "Maharlika Suite"; $room_type->description = "(4-5 persons)"; $room_type->rate = 4500; $room_type->save(); $room_type = new RoomType(); $room_type->name = "Dorm Type Room"; $room_type->description = "(10 persons)"; $room_type->rate = 6000; $room_type->save(); $room = new Room(); $room->no = "101"; $room->view = "Pool"; $room->room_type_id = 6; $room->description = "5 Single Bed, 1 QS Bed"; $room->type = "available_online"; $room->save(); $room = new Room(); $room->no = "102"; $room->view = "Pool"; $room->room_type_id = 6; $room->description = "5 Single Bed, 1 QS Bed"; $room->type = "available_online"; $room->save(); $room = new Room(); $room->no = "103"; $room->view = "Pool"; $room->room_type_id = 6; $room->description = "5 Single Bed, 1 QS Bed"; $room->type = "available_online"; $room->save(); $room = new Room(); $room->no = "104"; $room->view = "Pool"; $room->room_type_id = 6; $room->description = "5 Single Bed, 1 QS Bed"; $room->save(); $room = new Room(); $room->no = "105"; $room->view = "No View"; $room->room_type_id = 4; $room->description = "3 Single Bed, 1 QS Bed"; $room->save(); $room = new Room(); $room->no = "106"; $room->view = "No View"; $room->room_type_id = 4; $room->description = "3 Single Bed, 1 QS Bed"; $room->type = "available_online"; $room->save(); $room = new Room(); $room->no = "107"; $room->view = "No View"; $room->room_type_id = 4; $room->description = "3 Single Bed, 1 QS Bed"; $room->type = "available_online"; $room->save(); $room = new Room(); $room->no = "108"; $room->view = "No View"; $room->room_type_id = 4; $room->description = "3 Single Bed, 1 QS Bed"; $room->type = "available_online"; $room->save(); $room = new Room(); $room->no = "109"; $room->view = "No View"; $room->room_type_id = 4; $room->description = "3 Single Bed, 1 QS Bed"; $room->save(); $room = new Room(); $room->no = "110"; $room->view = "No View"; $room->room_type_id = 3; $room->description = "2 Queen Size Bed"; $room->type = "available_online"; $room->save(); $room = new Room(); $room->no = "111"; $room->view = "No View"; $room->room_type_id = 3; $room->description = "2 Queen Size Bed"; $room->type = "available_online"; $room->save(); $room = new Room(); $room->no = "112"; $room->view = "No View"; $room->room_type_id = 3; $room->description = "2 Queen Size Bed"; $room->save(); $room = new Room(); $room->no = "113"; $room->view = "No View"; $room->room_type_id = 3; $room->description = "2 Queen Size Bed"; $room->save(); $room = new Room(); $room->no = "114"; $room->view = "No View"; $room->room_type_id = 3; $room->description = "2 Queen Size Bed"; $room->type = "available_online"; $room->save(); $room = new Room(); $room->no = "201"; $room->view = "Balcony"; $room->room_type_id = 2; $room->description = "2 Queen Size Bed"; $room->type = "available_online"; $room->save(); $room = new Room(); $room->no = "202"; $room->view = "Balcony"; $room->room_type_id = 2; $room->description = "2 Queen Size Bed"; $room->type = "available_online"; $room->save(); $room = new Room(); $room->no = "203"; $room->view = "Balcony"; $room->room_type_id = 2; $room->description = "2 Queen Size Bed"; $room->type = "available_online"; $room->save(); $room = new Room(); $room->no = "204"; $room->view = "Balcony"; $room->room_type_id = 2; $room->description = "2 Queen Size Bed"; $room->save(); $room = new Room(); $room->no = "205"; $room->view = "Balcony"; $room->room_type_id = 1; $room->description = "2 Queen Size Bed"; $room->save(); $room = new Room(); $room->no = "206"; $room->view = "No View"; $room->room_type_id = 5; $room->description = "4 Single Bed, 1 QS Bed"; $room->type = "available_online"; $room->save(); $room = new Room(); $room->no = "207"; $room->view = "No View"; $room->room_type_id = 5; $room->description = "4 Single Bed, 1 QS Bed"; $room->type = "available_online"; $room->save(); $room = new Room(); $room->no = "208"; $room->view = "No View"; $room->room_type_id = 5; $room->description = "4 Single Bed, 1 QS Bed"; $room->type = "available_online"; $room->save(); $room = new Room(); $room->no = "209"; $room->view = "No View"; $room->room_type_id = 5; $room->description = "4 Single Bed, 1 QS Bed"; $room->save(); $room = new Room(); $room->no = "210"; $room->view = "No View"; $room->room_type_id = 5; $room->description = "4 Single Bed, 1 QS Bed"; $room->save(); $room = new Room(); $room->no = "211"; $room->view = "No View"; $room->room_type_id = 3; $room->description = "1 Single Bed, 1 QS Bed"; $room->save(); $room = new Room(); $room->no = "212"; $room->view = "No View"; $room->room_type_id = 3; $room->description = "1 Single Bed, 1 QS Bed"; $room->save(); $room = new Room(); $room->no = "213"; $room->view = "No View"; $room->room_type_id = 3; $room->description = "1 Single Bed, 1 QS Bed"; $room->type = "available_online"; $room->save(); $room = new Room(); $room->no = "301"; $room->view = "No View"; $room->room_type_id = 1; $room->description = "1 Single Bed, 1 QS Bed"; $room->type = "available_online"; $room->save(); $room = new Room(); $room->no = "302"; $room->view = "No View"; $room->room_type_id = 1; $room->description = "1 Single Bed, 1 QS Bed"; $room->type = "available_online"; $room->save(); $room = new Room(); $room->no = "303"; $room->view = "No View"; $room->room_type_id = 1; $room->description = "1 Single Bed, 1 QS Bed"; $room->type = "available_online"; $room->save(); $room = new Room(); $room->no = "304"; $room->view = "No View"; $room->room_type_id = 1; $room->description = "1 Single Bed, 1 QS Bed"; $room->save(); $room = new Room(); $room->no = "305"; $room->view = "No View"; $room->room_type_id = 1; $room->description = "1 Single Bed, 1 QS Bed"; $room->save(); $room = new Room(); $room->no = "306"; $room->view = "No View"; $room->room_type_id = 7; $room->description = "3 Single Bed"; $room->save(); $room = new Room(); $room->no = "308"; $room->view = "No View"; $room->room_type_id = 7; $room->description = "1 Queen Size Bed"; $room->type = "available_online"; $room->save(); $room = new Room(); $room->no = "401"; $room->view = "No View"; $room->room_type_id = 8; $room->description = "2 Queen Size Bed"; $room->save(); $room = new Room(); $room->no = "Dorm A"; $room->view = "Parking"; $room->room_type_id = 9; $room->description = "5 Double Decks"; $room->type = "available_online"; $room->save(); $room = new Room(); $room->no = "Dorm B"; $room->view = "Parking"; $room->room_type_id = 9; $room->description = "5 Double Decks"; $room->save(); }
/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(PostRoomsRequest $request) { $room = new Room(); $price = $request->get('price'); $room->price = Room::preg_check($price); $room->share_basis = $request->get('share_basis'); $room->available = $request->get('date'); $room->bedroom = $request->get('bedrooms'); $room->bathrooms = $request->get('bathrooms'); $room->smoking = $request->get('smoking'); $room->furnished = $request->get('furnished'); $room->parking = $request->get('parking'); $room->pet_friendly = $request->get('pet_friendly'); $room->gender_friendly = $request->get('gender_friendly'); $room->title = $request->get('title'); $room->description = $request->get('description'); $room->name = $request->get('name'); $room->phone = $request->get('phone'); $room->address = $request->get('address'); $result = array(); if (Input::has('photo')) { $photo = Input::file('photo'); $photoSize = $photo->getsize(); if ($photoSize > $_ENV['max_file_size']) { $results = array('size' => $photoSize, 'name' => $filename = time() . '-' . $photo->getClientOriginalName(), 'photoSizedError' => 'File size can not be more than ' . $_ENV['max_file_size'] / 1000000 . 'mb'); } else { //Renaming file name and saving. $filename = time() . '-' . $photo->getClientOriginalName(); $destination = public_path() . '/img/' . $filename; if (!File::exists($destination)) { try { $photo_path = $photo->move(public_path() . '/img/', $filename, 100); $room->urls = $filename; } catch (Fileexception $e) { return 'Sorry, Could not upload the file! Please, try again later!!'; } } else { return 'This File already exist!! Please, upload another file!!!'; } } } if ($room->save()) { return redirect('rooms')->with('flash_message', 'Your posting has been completed successfully'); } }