/**
  * 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!');
 }
Ejemplo n.º 2
0
 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.');
 }
Ejemplo n.º 3
0
 /**
  * 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();
     }
 }
Ejemplo n.º 4
0
 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);
 }
Ejemplo n.º 5
0
 /**
  * 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");
 }
 public function done(Request $request)
 {
     $this->validate($request, ['startDate' => 'required', 'endDate' => 'required', 'room' => 'required'], ['startDate.required' => 'Incheckinings-datum måste anges!', 'endDate.required' => 'Utcheckinings-datum måste anges!', 'room.required' => 'Rum måste väljas']);
     Order::updateOrCreate(['id' => $request->submit], array('arrives' => $request->startDate, 'departures' => $request->endDate, 'roomid' => $request->room));
     $room = Room::where(['id' => $request->room])->first();
     return view('booking.done', ['room' => $room, 'startDate' => $request->startDate, 'endDate' => $request->endDate]);
 }
Ejemplo n.º 7
0
 /**
  * POST /api/login
  */
 public function login()
 {
     // Get all data send in post
     $loginFormData = Request::all();
     // Create rules for the validator
     $validator = Validator::make($loginFormData, ['user_email' => 'required|email', 'user_password' => 'required']);
     // If validator fails return a 404 response
     if ($validator->fails()) {
         return Response::json(['status_code' => 404, 'errors' => $validator->errors()->all()], 404);
     }
     $user = User::where('email', '=', strtolower($loginFormData['user_email']))->first();
     if (!$user) {
         return Response::json(['status_code' => 404, 'errors' => ['Votre compte est introuvable dans notre base de donnée.']], 404);
     } else {
         if ($user->activated == 0) {
             return Response::json(['status_code' => 404, 'errors' => ["Merci d'activer votre compte."]], 404);
         } else {
             if (!Hash::check($loginFormData['user_password'], $user->password)) {
                 return Response::json(['status_code' => 404, 'errors' => ["Votre mot de passe est incorrect."]], 404);
             }
         }
     }
     $room = Room::find($user->room_id);
     $partner = User::find($user->is_partner ? $room->user_id : $room->partner_id);
     if ($partner->activated == 0) {
         return Response::json(['status_code' => 404, 'errors' => ["Le compte de votre partenaire n'a pas été activé."]], 404);
     }
     // Success
     return Response::json(['status_code' => 200, 'success' => "Login success", 'data' => ['me' => $user, 'partner' => $partner, 'room' => $room]]);
 }
 public function saveReservation(Request $request)
 {
     $reservation = new Reservation();
     if (!$request->input('locator_id') || !Locator::find($request->input('locator_id'))) {
         return response('Lokator nie został sprecyzowany', 500)->header('Content-Type', 'text/html; charset=utf-8');
     }
     if (!$request->input('rooms')) {
         return response('Pokoje nie zostały sprecyzowane', 500)->header('Content-Type', 'text/html; charset=utf-8');
     }
     foreach ($request->input('rooms') as $room) {
         if (!Room::find($room)) {
             return response('Pokój o numerze ' . $room . ' nie jest zdefiniowany w bazie danych.', 500)->header('Content-Type', 'text/html; charset=utf-8');
         }
     }
     $reservation->locator_id = $request->input('locator_id');
     $reservation->reservation_time = date('Y-m-d H:i:sZ', time());
     $reservation->since = $request->input('since');
     $reservation->till = $request->input('till');
     $reservation->is_paid = $request->input('is_paid');
     $reservation->dinners_count = $request->input('dinners_count');
     $reservation->people_count = $request->input('people_count');
     $reservation->save();
     $reservation->rooms()->sync($request->input('rooms'));
     $reservation->save();
     return response()->json($reservation);
 }
Ejemplo n.º 9
0
 public function status($statusType)
 {
     if (1 == $statusType) {
         $buildingNumber = Building::count();
         $roomNumber = Room::count();
         $buildingRet = ['buildingNumber' => $buildingNumber, 'roomNumber' => $roomNumber];
         return $buildingRet;
     } else {
         if (2 == $statusType) {
             $roomNumber = Room::count();
             $rentedRoomNumber = Contract::count();
             $emptyRoomNumber = $roomNumber - $rentedRoomNumber;
             $rentRet = ['roomNumber' => $roomNumber, 'rentedNumber' => $rentedRoomNumber, 'emptyNumber' => $emptyRoomNumber];
             return $rentRet;
         } else {
             if (3 == $statusType) {
                 $feePlanItem = DB::select('SELECT COUNT(DISTINCT feemeta_id) as counts FROM fee_plans WHERE status=0 AND deleted_at IS NULL');
                 $feePlanRentNumber = DB::select('SELECT COUNT(DISTINCT rent_id) as counts FROM fee_plans WHERE status=0 AND deleted_at IS NULL');
                 $feeRet = ['feePlanNumber' => $feePlanItem[0]->counts, 'feePlanRentNumber' => $feePlanRentNumber[0]->counts];
                 return $feeRet;
             } else {
                 if (4 == $statusType) {
                     $userNumber = User::count();
                     $userRet = ['userCount' => $userNumber];
                     return $userRet;
                 }
             }
         }
     }
 }
Ejemplo n.º 10
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker\Factory::create();
     for ($i = 0; $i < 5; $i++) {
         Room::create(['name' => 'Room ' . $faker->colorName, 'icon' => 'star', 'color' => 'blue', 'daycare_id' => 1]);
     }
 }
 public function create()
 {
     $typeRooms = TypeRoom::All();
     $rooms = Room::All()->where('state_id', 5);
     $typePlan = TypePlan::All();
     return view('Rooms.create', ['typeRooms' => $typeRooms], ['rooms' => $rooms], ['typePlan' => $typePlan]);
 }
Ejemplo n.º 12
0
 /**
  * GHet user by ID
  *
  * @return Response
  */
 public function store()
 {
     /**
      * Création d'un utilisateurs + Création d'une room si pas de room ou alors complet
      */
     // Remplissage des data, pour l'insertion
     $data = \Input::get('data');
     $pseudoExist = \App\Users::where('pseudo', '=', $data['pseudo'])->count();
     if ($pseudoExist >= 1) {
         return response()->json('Votre pseudo est déjà utiliser sur cette partie, veuillez saisir un autre pseudo', 200);
     } else {
         \App\Users::create($data);
     }
     // Dérnier inscris
     $users = \App\Users::orderBy('id', 'desc')->limit(1)->get();
     /* Création d'une room */
     $userRoom = \App\User_Room::count();
     if ($userRoom == 0 || $userRoom == 5 || $userRoom == 10 || $userRoom == 15 || $userRoom == 20 || $userRoom == 25 || $userRoom == 30 || $userRoom == 35 || $userRoom == 40 || $userRoom == 45 || $userRoom == 50 || $userRoom == 55 || $userRoom == 60 || $userRoom == 65 || $userRoom == 70 || $userRoom == 75 || $userRoom == 80 || $userRoom == 85 || $userRoom == 90 || $userRoom == 95 || $userRoom == 100) {
         $room = new \App\Room();
         $room->status = 1;
         $room->save();
     }
     // dérniere Room
     $showRoom = \App\Room::orderBy('id', 'desc')->limit(1)->get();
     /* Création des users sur une room */
     $user_room = new \App\User_Room();
     $user_room->id_users = $users[0]->id;
     $user_room->id_room = $showRoom[0]->id;
     $user_room->score;
     $user_room->gagner;
     $user_room->nbr_ligne;
     $user_room->save();
     return response()->json('Création du joueur avec succès', 200);
 }
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $dt = Carbon::createFromDate(2016, 1, 1);
     $rooms = Room::all();
     foreach ($rooms as $room) {
         $timeslots = $room->timeslots()->where('begin', '<=', $dt)->where('end', '>=', $dt)->where('day_id', '=', Carbon::now()->dayOfWeek)->get();
         $this->controlLED($room, $timeslots);
         if (sizeof($timeslots) > 0 && $this->compareTemperatures($room)) {
             $this->startRelay($room);
             continue;
         } else {
             if ($room->heatingsince != null) {
                 $heating = Carbon::createFromFormat('Y-m-d H:i:s', $room->heatingsince);
                 $heating->addMinutes($room->activeduration);
                 if ($heating > Carbon::now() && $this->compareTemperatures($room)) {
                     $this->startRelay($room);
                     continue;
                 } else {
                     $room->heatingsince = null;
                     $room->save();
                 }
             }
         }
         $this->stopRelay($room);
     }
 }
Ejemplo n.º 14
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $this->info($this->argument('room'));
     $room = Room::find($this->argument('room'));
     $room->heatingsince = Carbon::now();
     $room->save();
     $process = new Process('php /var/www/artisan temperatures:check');
     $process->run();
 }
Ejemplo n.º 15
0
Archivo: Room.php Proyecto: oredla/p4
 public static function roomsForDropdown()
 {
     $rooms = \App\Room::orderBy('room_name', 'ASC')->get();
     $rooms_for_dropdown = [];
     foreach ($rooms as $room) {
         $rooms_for_dropdown[$room->id] = $room->room_name;
     }
     return $rooms_for_dropdown;
 }
Ejemplo n.º 16
0
 /**
  * Test join with pin
  */
 public function testJoinPin()
 {
     $this->visit('/room/create')->type('unit_testing', 'name')->check('public')->press('my_submit');
     //edit room
     $room = Room::where('name', 'unit_testing')->firstOrFail();
     $this->visit('/room/withPin')->type($room->access_pin, 'access_pin');
     //TODO crashes from external redirect
     //->press('join_withPin_submit');
 }
 /**
  * add a checkout
  * @param  Request $request [description]
  * @return [type]           [description]
  */
 public function addCheckout(Request $request)
 {
     $checkout = new Checkout();
     $checkout = $request->all();
     Checkout::create($checkout);
     //update status room
     Room::where('name', $checkout['room_name'])->update(array('status' => 'A'));
     return redirect()->route('listroom_com');
 }
 public function updateRoomFormSubmit(updateRoomFormSubmitRequest $request)
 {
     $id = \Input::get('room_id');
     $room_name = \Input::get('room_name');
     $room_type = \Input::get('room_type');
     $room_description = \Input::get('room_description');
     $room_price = \Input::get('room_price');
     Room::updateRoomDetails($id, $room_name, $room_type, $room_description, $room_price);
     return redirect('adminUpdateRoom_' . $id)->with('message', "Successfully Updated!!!");
 }
Ejemplo n.º 19
0
 /**
  * GHet user by ID
  *
  * @return Response
  */
 public function store()
 {
     /**
      * Création d'une room simple, Ajout d'un users_room automatiquement, voir controller users méthod store
      */
     // Remplissage des data, pour l'insertion
     $data = \Input::get('data');
     \App\Room::create($data);
     return response()->json('Création de la room avec succès', 200);
 }
Ejemplo n.º 20
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $room_id = \App\Room::where('room_name', '=', '2nd Floor Conference Room')->pluck('id');
     DB::table('timeslots')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'room_id' => $room_id, 'available_from' => '09:00:00', 'available_until' => '18:00:00', 'available_weekdays' => '0101110']);
     $room_id = \App\Room::where('room_name', '=', '2nd Floor Conference Room')->pluck('id');
     DB::table('timeslots')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'room_id' => $room_id, 'available_from' => '20:00:00', 'available_until' => '21:00:00', 'available_weekdays' => '0100010']);
     $room_id = \App\Room::where('room_name', '=', 'Room 103')->pluck('id');
     DB::table('timeslots')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'room_id' => $room_id, 'available_from' => '09:00:00', 'available_until' => '12:00:00', 'available_weekdays' => '0111110']);
     $room_id = \App\Room::where('room_name', '=', 'Room 101')->pluck('id');
     DB::table('timeslots')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'room_id' => $room_id, 'available_from' => '10:00:00', 'available_until' => '16:00:00', 'available_weekdays' => '1000011']);
 }
Ejemplo n.º 21
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $codes = ["1-305", "1-315", "2-260", "2-269", "2-286", "2-102", "2-103", "Forum", "Chapel"];
     foreach ($codes as $code) {
         try {
             Room::create(['code' => $code]);
         } catch (Exception $e) {
             print $e->getMessage();
         }
     }
 }
 public function testReservationRoomExample()
 {
     $reservationRepo = new ReservationRepository(new ReservationStore());
     $start_date = '2015-10-01';
     $end_date = '2015-10-10';
     $user_id = App\User::first()->id;
     $rooms = Room::take(2)->lists('id')->toArray();
     $reservation = $reservationRepo->create(['date_start' => $start_date, 'date_end' => $end_date, 'rooms' => $rooms, 'reservation_number' => '0001', 'user_id' => $user_id]);
     $this->assertInstanceOf('App\\Reservation', $reservation);
     $this->assertEquals('2015-10-01', $reservation->date_start);
     $this->assertEquals(2, count($reservation->rooms));
 }
Ejemplo n.º 23
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker\Factory::create();
     $room_id = \App\Room::where('room_name', '=', '2nd Floor Conference Room')->pluck('id');
     $user_id = \App\User::where('email', '=', '*****@*****.**')->pluck('id');
     $admin_id = \App\User::where('email', '=', '*****@*****.**')->pluck('id');
     DB::table('reservations')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'room_id' => $room_id, 'user_id' => $user_id, 'user_group' => 'Joshua 1 Fellowship', 'description_of_event' => $faker->text($maxNbChars = 200), 'date_of_event' => DateTime::createFromFormat('m-j-Y', '12-24-2015'), 'start_time' => '09:00:00', 'end_time' => '09:30:00', 'expected_num_of_attendees' => 10, 'status' => 'approved', 'status_notes' => 'approved on 12/14/15.', 'approved_by' => $admin_id]);
     DB::table('reservations')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'room_id' => $room_id, 'user_id' => $user_id, 'user_group' => 'Joshua 1 Fellowship', 'description_of_event' => $faker->text($maxNbChars = 200), 'date_of_event' => DateTime::createFromFormat('m-j-Y', '12-24-2013'), 'start_time' => '09:00:00', 'end_time' => '14:30:00', 'expected_num_of_attendees' => 10, 'status' => 'approved', 'status_notes' => 'approved on 12/14/15.', 'approved_by' => $admin_id]);
     DB::table('reservations')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'room_id' => $room_id, 'user_id' => $user_id, 'user_group' => 'Joshua 1 Fellowship', 'description_of_event' => $faker->text($maxNbChars = 200), 'date_of_event' => DateTime::createFromFormat('m-j-Y', '12-25-2015'), 'start_time' => '09:00:00', 'end_time' => '09:30:00', 'expected_num_of_attendees' => 10, 'status' => 'approved', 'status_notes' => 'approved on 12/14/15.', 'approved_by' => $admin_id]);
     $room_id = \App\Room::where('room_name', '=', '2nd Floor Piano Room')->pluck('id');
     DB::table('reservations')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'room_id' => $room_id, 'user_id' => $user_id, 'user_group' => 'Joshua 2 Fellowship', 'description_of_event' => $faker->text($maxNbChars = 200), 'date_of_event' => DateTime::createFromFormat('m-j-Y', '12-25-2015'), 'start_time' => '09:00:00', 'end_time' => '09:30:00', 'expected_num_of_attendees' => 10, 'status' => 'approved', 'status_notes' => 'approved on 12/14/15.', 'approved_by' => $admin_id]);
 }
Ejemplo n.º 24
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $timeslots = factory(Timeslot::class)->times(4)->create();
     $rooms = Room::all();
     if (count($rooms) == 0) {
         $rooms = factory(Room::class)->times(4)->create();
     }
     foreach ($timeslots as $timeslot) {
         /** @var Timeslot $timeslot */
         $timeslot->rooms()->sync($rooms->random(2));
     }
 }
Ejemplo n.º 25
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker::create();
     $reservations = Reservation::all();
     $room = DB::table('room')->min('id');
     foreach ($reservations as $reservation) {
         $reservedRoom = new ReservedRoom();
         $reservedRoom->reservation_id = $reservation->id;
         $reservedRoom->room_id = $room;
         $reservedRoom->save();
         $room = Room::where('id', '>', $room)->min('id');
     }
 }
Ejemplo n.º 26
0
 public function changeAvailability($id)
 {
     $room = Room::findOrFail($id);
     if ($room['available'] == 1) {
         $room->available = 0;
         $room->save();
         return redirect()->route('timeslot.remove_room', compact('room'));
     } else {
         $room->available = 1;
         $room->save();
         return redirect()->route('timeslot.add_room', compact('room'));
     }
 }
Ejemplo n.º 27
0
 public function confirmRooms($id)
 {
     $roomID = Room::findOrFail($id);
     $roomNo = $roomID->Room_No;
     $roomType = $roomID->RoomType;
     $roomCapacity = $roomID->RoomCapacity;
     $roomRate = $roomID->RoomRate;
     $roomName = $roomID->RoomName;
     $checkin = Request::get('temporaryCheckIn');
     $checkout = Request::get('temporaryCheckOut');
     $adults = Request::get('temporaryAdults');
     $children = Request::get('temporaryChildren');
     return view('pages.reservation.inputinfo', compact('checkin', 'checkout', 'adults', 'children', 'roomType', 'roomCapacity', 'roomRate', 'roomName', 'roomNo'));
 }
Ejemplo n.º 28
0
 /**
  * Define your route model bindings, pattern filters, etc.
  *
  * @param  \Illuminate\Routing\Router  $router
  * @return void
  */
 public function boot(Router $router)
 {
     $router->bind('facility', function ($slug) {
         return \App\Facility::where('slug', $slug)->first();
     });
     $router->bind('type', function ($slug) {
         return \App\RoomType::where('slug', $slug)->first();
     });
     $router->bind('room', function ($room_no) {
         return \App\Room::where('room_no', $room_no)->first();
     });
     $router->model('reservation', 'App\\Reservation');
     parent::boot($router);
 }
Ejemplo n.º 29
0
 public function updateRoom(Request $request, $number)
 {
     $room = Room::find($number);
     if (!$room) {
         return response('Pokój nie został odnaleziony.', 404)->header('Content-Type', 'text/html; charset=utf-8');
     }
     if ($request->input('number')) {
         $room->number = $request->input('number');
     }
     if ($request->input('capacity')) {
         $room->capacity = $request->input('capacity');
     }
     $room->save();
     return response()->json($room);
 }
Ejemplo n.º 30
0
 public function update($roomId)
 {
     $request = json_decode(request()->getContent());
     $rules = array('name' => 'required', 'capacity' => 'required', 'status' => 'required');
     $validation = Validator::make((array) $request, $rules);
     if ($validation->fails()) {
         return response()->json(array('error' => true, 'message' => $validation->errors()->all(), 200));
     }
     $room = Room::find($roomId);
     $room->name = $request->name;
     $room->capacity = abs($request->capacity);
     $room->status = $request->status;
     $updated = $room->save();
     return response()->json(array('error' => !$updated, 'rooms' => $room->toArray()), $updated ? 200 : 500);
 }