/**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(UCreateReservationRequest $request)
 {
     $user = Auth::user();
     $reservation = new Reservation();
     $reservation->fill(['forwho' => $user->full_name, 'whoid' => $user->id, 'status' => 'created']);
     $reservation->fill($request->all());
     $reservation->save();
     return redirect()->route('user.reservations.index');
 }
 /**
  * Store a new reservation
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function create(Client $client, Request $request, Authenticatable $user, $id)
 {
     $this->validate($request, ['message' => 'required|string']);
     $property = VacationProperty::find($id);
     $reservation = new Reservation($request->all());
     $reservation->respond_phone_number = $user->fullNumber();
     $reservation->user()->associate($property->user);
     $property->reservations()->save($reservation);
     $this->notifyHost($client, $reservation);
     $request->session()->flash('status', "Sending your reservation request now.");
     return redirect()->route('property-show', ['id' => $property->id]);
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $hostUser = new User(['name' => 'Captain Kirk', 'email' => '*****@*****.**', 'password' => Hash::make('strongpassword'), 'country_code' => '1', 'phone_number' => '5558180101']);
     $hostUser->save();
     $guestUser = new User(['name' => 'Mr. Spock', 'email' => '*****@*****.**', 'password' => Hash::make('l1v3l0ngandpr0sp3r'), 'country_code' => '1', 'phone_number' => '5558180202']);
     $guestUser->save();
     $property = new VacationProperty(['description' => 'USS Enterprise', 'image_url' => 'http://www.ex-astris-scientia.org/articles/new_enterprise/enterprise-11-11-08.jpg']);
     $hostUser->properties()->save($property);
     $reservation = new Reservation(['message' => 'I want to reserve a room in your ship']);
     $reservation->respond_phone_number = $guestUser->fullNumber();
     $reservation->user()->associate($hostUser);
     $property->reservations()->save($reservation);
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker::create();
     $guests = Guest::All();
     for ($i = 1; $i <= 20; $i++) {
         $guest = $guests->random();
         $startDate = $faker->dateTimeBetween("now", "+12 days");
         $endDate = $faker->dateTimeBetween($startDate, "+ 1 month");
         $reservation = new Reservation();
         $reservation->date_in = $startDate;
         $reservation->date_out = $endDate;
         $reservation->made_by = "Faker";
         $reservation->guest_id = $guest->id;
         $reservation->save();
     }
 }
 public function createReservation(Request $request)
 {
     $room_info = $request['room_info'];
     $start_dt = Carbon::createFromFormat('d-m-Y', $request['start_dt'])->toDateString();
     $end_dt = Carbon::createFromFormat('d-m-Y', $request['end_dt'])->toDateString();
     $customer = Customer::firstOrCreate($request['customer']);
     $reservation = Reservation::create();
     $reservation->total_price = $room_info['total_price'];
     $reservation->occupancy = $request['occupancy'];
     $reservation->customer_id = $customer->id;
     $reservation->checkin = $start_dt;
     $reservation->checkout = $end_dt;
     $reservation->save();
     $date = $start_dt;
     while (strtotime($date) < strtotime($end_dt)) {
         $room_calendar = RoomCalendar::where('day', '=', $date)->where('room_type_id', '=', $room_info['id'])->first();
         $night = ReservationNight::create();
         $night->day = $date;
         $night->rate = $room_calendar->rate;
         $night->room_type_id = $room_info['id'];
         $night->reservation_id = $reservation->id;
         $room_calendar->availability--;
         $room_calendar->reservations++;
         $room_calendar->save();
         $night->save();
         $date = date("Y-m-d", strtotime("+1 day", strtotime($date)));
     }
     $nights = $reservation->nights;
     $customer = $reservation->customer;
     return $reservation;
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int $id
  * @return Response
  */
 public function edit($id)
 {
     $reservation = Reservation::findOrFail($id);
     $reservation->fill(['status' => 'canceled']);
     $reservation->save();
     return redirect()->back();
 }
 public function run()
 {
     $faker = Faker\Factory::create();
     $dates = ['2016-01-19', '2016-01-20', '2016-01-21', '2016-01-22'];
     $times = ['08:00:00', '09:00:00', '10:00:00', '11:00:00', '12:00:00', '13:00:00', '14:00:00', '15:00:00'];
     foreach (range(1, 500) as $index) {
         Reservation::create(['id' => $index, 'first_name' => $faker->firstName, 'last_name' => $faker->lastName, 'specialty' => $faker->word, 'email' => $faker->email . $index, 'date' => $faker->randomElement($dates), 'time' => $faker->randomElement($times)]);
     }
 }
 private function composeNotif()
 {
     \View::composer(['operator.partials.header'], function ($view) {
         $notifs = Reservation::with(['user', 'paket'])->where('confirm_operator', false)->get();
         if (\Auth::user()->role->id == 1) {
             # code...
             $view->with(['notifs' => Reservation::with(['user', 'paket'])->where('confirm_operator', false)->valid()->get()]);
         } else {
             $view->with(['notifs' => Reservation::with(['user', 'paket'])->valid()->get()]);
         }
     });
 }
Exemple #9
0
 public function invoice($id)
 {
     $user = Auth::user();
     $reservation = Reservation::findOrFail($id);
     $service = Service::findOrFail($reservation->serviceid);
     $date = date('Y-m-d');
     $view = \View::make('user.reservations.thisreservation', compact('date', 'service', 'reservation', 'user'))->render();
     //return view('user.reservations.thisreservation', compact('data', 'date', 'invoice'));
     $pdf = \App::make('dompdf.wrapper');
     //dd($pdf);
     $pdf->loadHTML($view);
     return $pdf->download('Reservation');
 }
 /**
  * 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');
     }
 }
 /**
  * Process and generate data could be accepted by
  * {@link http://www.highcharts.com/ Charts}
  * for a given year.
  *
  * @param $year
  * @return \Illuminate\View\View
  */
 public function chart($year)
 {
     $dt = Carbon::createFromDate($year, 1, 1);
     $dt_diff = Carbon::createFromDate($year, 1, 1)->endOfYear();
     $reservations = Reservation::whereBetween('arrive_at', [$dt, $dt_diff])->where('is_valid', true)->get();
     $tmp = [];
     foreach ($reservations as $reservation) {
         $arrive_at = Carbon::parse($reservation->arrive_at);
         $leave_at = Carbon::parse($reservation->leave_at);
         while ($arrive_at->lte($leave_at)) {
             $month = $this->months[$arrive_at->month - 1];
             if (empty($tmp[$arrive_at->month][$arrive_at->day])) {
                 $tmp[$arrive_at->month][$arrive_at->day] = 0;
             }
             $tmp[$arrive_at->month][$arrive_at->day] += $reservation->nb_people;
             $arrive_at->addDay();
         }
     }
     $monthly = ['categories' => [], 'data' => []];
     $daily = [];
     foreach ($tmp as $month => $list) {
         foreach ($list as $day => $nb) {
             $daily[$month]['categories'][] = $day;
             $daily[$month]['data'][] = round($nb / self::$MAX * 100);
         }
         $monthly['categories'][] = $month;
         $monthly['data'][] = round(max($list) / self::$MAX * 100);
     }
     ksort($daily);
     foreach ($daily as $month => $value) {
         asort($value['categories']);
         $keys = array_keys($value['categories']);
         $tmp = [];
         foreach ($keys as $i => $key) {
             $tmp[$i] = $value['data'][$key];
         }
         $value['data'] = $tmp;
         $value['categories'] = array_values($value['categories']);
         $daily[$month] = $value;
     }
     asort($monthly['categories']);
     $keys = array_keys($monthly['categories']);
     $tmp = [];
     foreach ($keys as $i => $key) {
         $tmp[$i] = $monthly['data'][$key];
     }
     $monthly['data'] = $tmp;
     $monthly['categories'] = array_values($monthly['categories']);
     $months = $this->months;
     return view('stats.chart', compact('year', 'monthly', 'daily', 'months'));
 }
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     // Get all reservations that are still valid.
     $reservations = Reservation::where('State', '=', 'fresh')->get();
     // Get the configuration information.
     $config = Configuration::find(0);
     foreach ($reservations as $reservation) {
         // Check if they should become expired.
         if (date('Y-m-d', strtotime($reservation->Created) + 86400 * $config->ReservationLife) < date('Y-m-d')) {
             $reservation->State = 'late';
             $reservation->save();
         }
     }
 }
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $allReservations = DB::table('reservations')->where('artwork_id', '=', Input::get('artwork-id'))->get();
     $reservation = new Reservation();
     $reservation->user_id = Auth::user()->id;
     $reservation->artwork_id = Input::get('artwork-id');
     $reservation->from_date = Input::get('from-date');
     $reservation->to_date = Input::get('to-date');
     $reservation->delivery_adress = Input::get('delivery_adress');
     $artwork = Artwork::findOrFail(Input::get('artwork-id'));
     $overlap = false;
     foreach ($allReservations as $key) {
         if (Input::get('from-date') < $key->to_date && Input::get('from-date') > $key->from_date) {
             $overlap = true;
         } elseif (Input::get('to-date') > $key->from_date && Input::get('to-date') < $key->to_date) {
             $overlap = true;
         } elseif (Input::get('from-date') == $key->from_date) {
             $overlap = true;
         }
     }
     if (!$overlap) {
         $artwork->reserved += 1;
         $reservation->save();
         $artwork->update(['reserved' => $artwork->reserved]);
         return Response::json([0 => 'Reservering geslaagd. Klik <a href="/gallery">hier</a> om terug te gaan'], HttpCode::Ok);
     } else {
         $latest = "";
         foreach ($allReservations as $key) {
             if (is_null($latest)) {
                 $latest = $key->to_date;
             } elseif ($key->to_date > $latest) {
                 $latest = $key->to_date;
             }
         }
         return Response::json([0 => 'Het kunstwerk is al gereserveerd op deze datum.'], HttpCode::Conflict);
     }
 }
 public function success(Request $request, Reservation $reservation)
 {
     //change reservation status to complete
     $payment_id = Session::get('paypal_payment_id');
     $reservation->status = 1;
     $reservation->payment_id = $payment_id;
     $cruise = Cruise::find($reservation->cruise_id);
     $cabin = Cabin::find($reservation->cabin_id);
     //deduct cabin number in the cruise
     DB::table('cruises_cabins')->where('cruise_id', $reservation->cruise_id)->where('cabin_id', $reservation->cabin_id)->increment('cabin_booked');
     $reservation->save();
     Session::forget('paypal_payment_id');
     $full = 0;
     foreach ($cruise->cabins as $cabin) {
         if ($cabin->pivot->cabin_number == $cabin->pivot->cabin_booked) {
             $full++;
         }
     }
     if ($full == Cabin::all()->count()) {
         $cruise->status = 1;
         $cruise->save();
     }
     return view('user.reservation', ['cruise' => $cruise, 'cabin' => $cabin, 'amenities' => $reservation->amenities()->get(), 'reservation' => $reservation])->with('status', 'Payment succcess!');
 }
 /**
  * Define the application's command schedule.
  * call this ' * * * * * php /path/to/artisan schedule:run 1>> /dev/null 2>&1 '
  * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
  * @return void
  */
 protected function schedule(Schedule $schedule)
 {
     $schedule->call(function () {
         $reservations = Reservation::where('end_date', '<', Carbon::now())->where('status', Reservation::STATUS_ACCEPTED)->get();
         foreach ($reservations as $reservation) {
             $reservation->status = Reservation::STATUS_DONE;
             if ($reservation->save()) {
                 $room = $reservation->room;
                 $count = (int) $room->occupants - 1;
                 $count = $count > 0 ? $count : 0;
                 $room->occupants = $count;
                 $room->save();
             }
         }
     })->daily();
 }
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        Model::unguard();
        User::create(['name' => 'Yohann', 'email' => '*****@*****.**', 'role' => 'admin', 'password' => bcrypt('admin'), 'phone' => '0125654520']);
        Post::create(['titre' => 'Exemple actu', 'contenu' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla sit amet congue nisi, eu egestas velit. Donec tincidunt nisi nec efficitur pretium. Aliquam arcu nisi, tristique in ex eget, ultricies accumsan erat. Aliquam erat volutpat. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Vivamus vitae massa ligula. Aenean fermentum tellus ut dapibus scelerisque. Morbi vel finibus nisl.

Integer feugiat dui nisl. Morbi sit amet massa eu libero lacinia volutpat ac in nisi. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Praesent facilisis magna eu ante venenatis commodo. Fusce auctor elit venenatis ipsum finibus viverra. Sed imperdiet molestie dui, eget dignissim massa gravida sit amet. In maximus est lectus, vitae consequat nibh imperdiet in. Maecenas maximus id dui sit amet hendrerit. Morbi a tellus vel magna ultricies egestas id ut mi. Duis sed dolor sit amet ipsum ullamcorper laoreet in id purus. Fusce vehicula orci et venenatis tristique.

Morbi nec cursus erat. Ut suscipit molestie nisi maximus cursus. Praesent quis luctus est. Nullam finibus metus dolor, a posuere est pretium id. Nullam ornare in purus sed efficitur. Vivamus id ipsum ut dui blandit dictum. Aenean ante elit, condimentum non libero vitae, blandit efficitur eros. Nullam rutrum tortor non orci congue, id auctor lacus hendrerit.

Phasellus fringilla sem placerat erat mollis mollis ut rhoncus nunc. Etiam ornare pretium tempus. Nunc felis metus, viverra eget hendrerit et, blandit nec purus. Aliquam ut lectus non nibh sodales mollis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris congue pellentesque nunc, in volutpat leo mattis sit amet. Etiam porta, turpis eu pharetra scelerisque, tortor tortor iaculis nisl, a fermentum sem felis vitae est. Pellentesque tristique, ex a fringilla sollicitudin, mi tellus gravida orci, vitae scelerisque nisi leo eu lectus.', 'chapo' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla sit amet congue nisi, eu egestas velit. Donec tincidunt nisi nec efficitur pretium. Aliquam arcu nisi, tristique in ex eget, ultricies accumsan erat. Aliquam erat volutpat.', 'slug' => 'exemple-actu']);
        Reservation::create(['user_id' => 1, 'velo_id' => 1, 'valide' => false]);
        Reservation::create(['user_id' => 1, 'velo_id' => 2, 'valide' => false]);
        Demijournee::create(['date' => '2010-05-02', 'periode' => 'am', 'reservation_id' => 1]);
        Demijournee::create(['date' => '2011-07-01', 'periode' => 'pm', 'reservation_id' => 2]);
        Velo::create(['modele' => 'Vélo de la mort', 'categorie' => 'enfant', 'image' => '']);
        Velo::create(['modele' => 'Véloette', 'categorie' => 'adulte', 'image' => '']);
    }
 /**
  * Save a reservation record to the database.
  *
  * @param ReservationRequest $request
  * @return mixed
  */
 public function store(ReservationRequest $request)
 {
     $reservation = Reservation::firstOrCreate(['email' => Input::get('physician_email')]);
     $reservation->date = Input::get('json_date');
     $reservation->time = Input::get('time_selection');
     $reservation->first_name = Input::get('physician_first_name');
     $reservation->last_name = Input::get('physician_last_name');
     $reservation->specialty = Input::get('physician_specialty');
     $reservation->email = Input::get('physician_email');
     if ($reservation->save()) {
         $data = ['date' => $reservation->date, 'time' => $reservation->time];
         Mail::send('emails.confirmation', $data, function ($m) use($reservation) {
             $m->from('*****@*****.**', 'Winthrop-University Hospital');
             $m->to($reservation->email, $reservation->email)->subject('EPCS Fingerprinting Reminder');
         });
         return response()->json(['first_name' => $reservation->first_name, 'message' => 'Submission Successful']);
     }
 }
 /**
  * Check available rooms
  *
  * @return array
  */
 public function checkAvailability(Request $request)
 {
     //add params start_date, end_date
     //Start date_input
     $input = $request->all();
     $currentOccupants = [];
     $rooms = Room::all();
     $check_date = Reservation::whereBetween('start_date', [$input['start_date'], $input['end_date']])->get();
     foreach ($rooms as $index => $room) {
         # code...
         $currentOccupants[$index] = Reservation::where('room_id', $room->id)->where('status', 'accepted')->where('start_date', '<=', [$input['start_date']])->where('end_date', '>=', [$input['end_date']])->count();
     }
     // //EOF date_input
     //display all_table
     $all_table = Room::where('availability', 'vacant')->get();
     // return view('welcome')->with('table',$table);
     return view('welcome')->with(compact('check_date', 'input', 'all_table', 'currentOccupants'));
 }
 public function storeSessionConfirm(Request $request)
 {
     $request->session()->put('message', $request['f-user_message']);
     $request->session()->put('newsletter', $request['f-newsletter']);
     $request->session()->put('agb', $request['f-agb']);
     $data = $request->session()->all();
     $reservation = new Reservation();
     $reservation->remember_token = $data['_token'];
     $reservation->date = $data['date'];
     $reservation->time = $data['time'];
     $reservation->pax = $data['pax'];
     $reservation->name = $data['name'];
     $reservation->email = $data['email'];
     $reservation->table = $data['table'];
     $reservation->message = $data['message'];
     $reservation->newsletter = $data['newsletter'];
     $reservation->agb = $data['agb'];
     $reservation->save();
 }
 public function cron()
 {
     $reservations = Reservation::where('end_date', '<', Carbon::now())->where('status', Reservation::STATUS_ACCEPTED)->get();
     foreach ($reservations as $reservation) {
         $reservation->status = Reservation::STATUS_DONE;
         if ($reservation->save()) {
             $room = $reservation->room;
             $count = (int) $room->occupants - 1;
             $count = $count > 0 ? $count : 0;
             $room->occupants = $count;
             if ($room->save()) {
                 return 'success';
             } else {
                 return 'error room';
             }
         } else {
             return 'error reservation';
         }
     }
 }
 public function something()
 {
     $date = date('d/m/Y', strtotime($request->get('date')));
     $time = $request->get('time');
     $reservations = Reservation::where('reservation_date', $date)->where('time', $time)->get();
     $ids = [];
     foreach ($reservations as $reservation) {
         $amenity = $reservation->amenityLoad()->first();
         if ($amenity->quantity < $amenity->limit) {
             $ids[] = $amenity->id;
         }
     }
     $rooms = null;
     $available = null;
     if (count($ids) == 0) {
         $rooms = Amenity::all();
     } else {
         $rooms = Amenity::whereNotIn('id', $ids)->room()->get();
     }
 }
 public function show($id)
 {
     return Reservation::find($id)->toArray();
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $input = \Request::all();
     $passenger = new Passenger();
     $passenger->title = $input['passenger_title'];
     $passenger->name = $input['passenger_name'];
     $passenger->sex = $input['passenger_sex'];
     $passenger->age = $input['passenger_age'];
     $passenger->address_line_1 = $input['passenger_address1'];
     $passenger->address_line_2 = $input['passenger_address2'];
     $passenger->address_line_3 = $input['passenger_address3'];
     $passenger->state = $input['passenger_state'];
     $passenger->country = $input['passenger_country'];
     $passenger->occupation = $input['passenger_occupation'];
     $passenger->cabin_id = $input['cabin_form'];
     $passenger->save();
     $reservation = new Reservation();
     $reservation->cruise_id = $input['cruise_form'];
     $reservation->cabin_id = $input['cabin_form'];
     $reservation->customer_id = \Auth::User()->id;
     $reservation->save();
     $cabin = Cabin::where('id', $input['cabin_form'])->first();
     $cabin->occupied = false;
     $cabin->save();
     return view('pages.index')->with('title', 'Welcome');
 }
 public function dataSelection($room, $block, $year, $month, $day, $atention, $medic)
 {
     $date = $year . "-" . $month . "-" . $day;
     $checkRoom = ReservationInfo::where('reservationDate', '=', $date)->where('block_id', '=', $block)->where('room', '=', $room)->count();
     if ($checkRoom == 0) {
         //revisar si el medico tiene ocupada esas horas
         $findMedicConflict = Reservation::where('medic_id', $medic)->where('reservationDate', $date)->get();
         $checkMedic = 0;
         foreach ($findMedicConflict as $register) {
             $checkMedic += $register->ReservationsInfo->where('block_id', $block)->count();
         }
         if ($checkMedic == 0) {
             //
             $atention = Atention::find($atention);
             $numberOfBlocks = $atention->block_numbers;
             for ($i = 1; $i < $numberOfBlocks; $i++) {
                 $nextBlock = $block + $i;
                 $checkRoom = ReservationInfo::where('reservationDate', '=', $date)->where('block_id', '=', $nextBlock)->where('room', '=', $room)->count();
                 if ($checkRoom > 0) {
                     //cortar con un return, ya que hay una hora tomada despues
                     //que impide hacer la reserva en el bloque seleccionado
                     return response()->json(['estado' => 'invalido', 'mensaje' => 'La sala esta ocupada']);
                 }
                 $checkMedic = 0;
                 foreach ($findMedicConflict as $register) {
                     $checkMedic += $register->ReservationsInfo->where('block_id', $nextBlock)->count();
                 }
                 if ($checkMedic > 0) {
                     //medico ocupado
                     return response()->json(['estado' => 'invalido', 'mensaje' => 'El medico esta ocupado en uno de los bloques']);
                 }
             }
             $initialBlock = Block::find($block);
             $lastBlockId = $block + $numberOfBlocks - 1;
             $encontro = false;
             $lastBlock;
             while ($encontro == false) {
                 if (!($lastBlock = Block::find($lastBlockId))) {
                     $lastBlockId--;
                 } else {
                     $encontro = true;
                 }
             }
             $respuesta = ['estado' => 'valido', 'inicio' => $initialBlock->startBlock, 'fin' => $lastBlock->finishBlock, 'bloques' => $numberOfBlocks, 'blolqueInicial' => $initialBlock->id, 'bloqueFinal' => $lastBlock->id];
             return response()->json($respuesta);
         } else {
             //el medico esta ocupado en ese bloque
             return response()->json(['estado' => 'invalido', 'mensaje' => 'El medico esta ocupado a esa hora']);
         }
     } else {
         //la sala esta ocupada en ese horario
         return response()->json(['estado' => 'invalido', 'mensaje' => 'La sala esta ocupada a esa hora']);
     }
 }
 public function updateReservations($id)
 {
     $reservation = Reservation::findOrFail($id);
     if ($reservation) {
         $reservation->Room_No = Request::get('reservationRegisterroomno');
         $reservation->Guest_No = Request::get('reservationRegisterguestno');
         $reservation->checkin = Request::get('reservationRegistercheckin');
         $reservation->checkout = Request::get('reservationRegistercheckout');
         $reservation->No_ChildGuest = Request::get('reservationRegisternochildguest');
         $reservation->No_OldGuest = Request::get('reservationRegisternooldguest');
         $reservation->No_Rooms = Request::get('reservationRegisternorooms');
         $reservation->status = Request::get('reservationRegisterstatus');
         $reservation->save();
     }
     Session::flash('flash_message', 'Reservation successfully updated');
     return redirect('auth/databasereservation');
 }
 public function confirmReservation()
 {
     $checkin = Request::get('temporaryCheckIn');
     $checkout = Request::get('temporaryCheckOut');
     $adults = Request::get('temporaryAdults');
     $children = Request::get('temporaryChildren');
     $roomtype = Request::get('temporaryRoomType');
     $roomcapacity = Request::get('temporaryRoomCapacity');
     $roomrate = Request::get('temporaryRoomRate');
     $roomname = Request::get('temporaryRoomName');
     $roomno = Request::get('temporaryRoomNo');
     $guestFirstName = Request::get('temporaryguestFirstName');
     $guestLastName = Request::get('temporaryguestLastName');
     $email = Request::get('temporaryguestEmail');
     $contact = Request::get('temporaryguestContact');
     if (Auth::user()->guest()) {
         $guest = new guest();
         $guest->username = rand(0, 9999);
         $guest->password = rand(0, 9999);
         $guest->first_name = $guestFirstName;
         $guest->last_name = $guestLastName;
         $guest->email = $email;
         $guest->contactNo = $contact;
         $guest->guestRegistration = 'Unregistered';
         $guest->save();
         $reservation = new Reservation();
         $reservation->Room_No = $roomno;
         $reservation->Guest_No = $guest->guest_No;
         $reservation->checkin = date_create($checkin);
         $reservation->checkout = date_create($checkout);
         $reservation->No_ChildGuest = $children;
         $reservation->No_OldGuest = $adults;
         $reservation->status = 'Reserved';
         $reservation->save();
     } else {
     }
     return view('pages.reservation.message');
 }
Exemple #27
0
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
Route::group(['namespace' => 'Operator', 'prefix' => 'operator', 'middleware' => ['auth', 'operator']], function () {
    get('dashboard', ['as' => 'operator.dashboard', 'uses' => 'DashboardController@index']);
    resource('notif', 'NotifController');
    resource('paket', 'PaketController');
    resource('member', 'MemberController');
    resource('galery', 'GaleryController');
});
Route::group(['prefix' => 'member', 'middleware' => ['auth']], function () {
    Route::resource('reservation', 'ReservationController');
    Route::get('/dashboard', ['as' => 'member.dashboard', 'uses' => 'ReservationController@dashboard']);
    Route::get('/wait/{id}', ['as' => 'wait', 'uses' => 'ReservationController@wait']);
});
Route::get('/', ['as' => 'welcome', 'uses' => 'WelcomeController@index']);
Route::get('/paket_detail/{id}', ['as' => 'paket.detail', 'uses' => 'WelcomeController@show']);
Route::post('/paket_detail/{id}', ['as' => 'paket.detail', 'uses' => 'WelcomeController@show']);
Route::get('/print/tiket/{id}', ['middleware' => 'auth'], function ($id) {
    $reservation = Reservation::with('user', 'paket')->find($id);
    return view('partials.print', compact('reservation'));
});
Route::controller('auth', 'Auth\\AuthController', ['getLogin' => 'auth.login', 'postLogin' => 'post.login', 'getLogout' => 'auth.logout', 'getRegister' => 'auth.register', 'postRegister' => 'post.register']);
Route::controller('password', 'Auth\\PasswordController');
 public function testAcceptRejectNoPending()
 {
     // Given
     $this->startSession();
     $userData = ['name' => 'Captain Kirk', 'email' => '*****@*****.**', 'password' => 'strongpassword', 'country_code' => '1', 'phone_number' => '5558180101'];
     $newUser = new User($userData);
     $newUser->save();
     $userData2 = ['name' => 'Captain Kirk rent', 'email' => '*****@*****.**', 'password' => 'strongpassword', 'country_code' => '1', 'phone_number' => '5558180102'];
     $newUser2 = new User($userData2);
     $newUser2->save();
     $propertyData = ['description' => 'Some description', 'image_url' => 'http://www.someimage.com'];
     $newProperty = new VacationProperty($propertyData);
     $newUser->properties()->save($newProperty);
     $reservationData = ['message' => 'Reservation message'];
     $reservation = new Reservation($reservationData);
     $reservation->status = 'confirmed';
     $reservation->respond_phone_number = $newUser2->fullNumber();
     $reservation->user()->associate($newUser);
     $newProperty->reservations()->save($reservation);
     $reservation = $reservation->fresh();
     $this->assertEquals('confirmed', $reservation->status);
     // When
     $response = $this->call('POST', route('reservation-incoming'), ['From' => '+15558180101', 'Body' => 'yes']);
     $messageDocument = new SimpleXMLElement($response->getContent());
     $reservation = $reservation->fresh();
     $this->assertEquals('confirmed', $reservation->status);
     $this->assertNotNull(strval($messageDocument->Message[0]));
     $this->assertNotEmpty(strval($messageDocument->Message[0]));
     $this->assertEquals(strval($messageDocument->Message[0]), 'Sorry, it looks like you don\'t have any reservations to respond to.');
 }
 /**
  * Helper to build DataBase Query
  * with filter and fields selection.
  * 
  * @param  array  $params
  * @return Illuminate\Database\Eloquent\Collection
  */
 protected function buildFilterQuery(array $params)
 {
     $ops = ['eq' => '=', 'lte' => '<=', 'gte' => '>=', 'lt' => '<', 'gt' => '>'];
     $fields = ['name', 'forename', 'arrive_at', 'leave_at', 'nb_people'];
     $limit = 10;
     $page = null;
     if (isset($params['limit']) and $params['limit'] > 0 and $params['limit'] < 100) {
         $limit = (int) $params['limit'];
     }
     if (isset($params['page']) and $params['page'] > 0) {
         $page = (int) $params['page'];
     }
     $select = ['*'];
     if (!empty($params['fields'])) {
         $select = explode(',', $params['fields']);
     }
     $reservation = Reservation::select($select);
     $reservation->addSelect('id');
     foreach ($params as $param => $value) {
         $tmp = explode('__', $param);
         if (isset($tmp[0]) and in_array($tmp[0], $fields) and isset($tmp[1]) and in_array($tmp[1], array_keys($ops))) {
             $field = $tmp[0];
             $op = $ops[$tmp[1]];
             $reservation = $reservation->where($field, $op, $value);
         }
     }
     if (!empty($params['valid'])) {
         $valid = $params['valid'] == 'true' ? true : false;
         $reservation = $reservation->where('is_valid', '=', $valid);
     }
     $paginator = $reservation->paginate($perPage = $limit, $columns = array('*'), $pageName = 'page', $page = $page);
     $paginator->appends($params);
     return $paginator;
 }
 public function updateStatus(Request $request, $id)
 {
     $user = $request->user();
     //return $user;
     $reservation = Reservation::find($id);
     $prev_status = $reservation->status;
     $respuesta = $request->only(['newStatus', 'commit']);
     $data_log = ['commit' => $respuesta['commit'], 'previus_status' => $reservation->status, 'new_status' => $respuesta['newStatus'], 'user_id' => $user->id, 'reservation_id' => $reservation->id];
     $log = new ReservationLog($data_log);
     $log->save();
     $reservation->status = $respuesta['newStatus'];
     $reservation->save();
     return response()->json(["respuesta" => "Actualizado", "id" => $reservation->id, "status" => $respuesta['newStatus']]);
 }