Ejemplo n.º 1
0
 public function search($input)
 {
     $query = BookingRoomTypes::query();
     $columns = Schema::getColumnListing('bookingRoomTypes');
     $attributes = array();
     foreach ($columns as $attribute) {
         if (isset($input[$attribute]) and !empty($input[$attribute])) {
             $query->where($attribute, $input[$attribute]);
             $attributes[$attribute] = $input[$attribute];
         } else {
             $attributes[$attribute] = null;
         }
     }
     return [$query->get(), $attributes];
 }
Ejemplo n.º 2
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index(Request $request, ReserveRoomRepository $reserveRoomRepo)
 {
     $roomTypes = BookingRoomTypes::all();
     $firstRoomType = $roomTypes->last();
     $now = new \DateTime('now');
     $startdate = $request->get('startdate', $now->format('Y-m-d'));
     $enddate = $request->get('enddate', $now->add(new \DateInterval('P10D'))->format('Y-m-d'));
     $room_type_id = $request->get('room_type_id', $firstRoomType->room_type_id);
     $reservation = new Reservation();
     if ($request->has('reserve_code')) {
         $reserve_code = $request->get('reserve_code');
         $reservation = Reservation::where('reserve_code', $reserve_code)->get()->first();
     }
     $calendar = $reserveRoomRepo->findReserveRoomsByRangeAndRoomType($startdate, $enddate, $room_type_id);
     $dates = Calendar::getInclusiveDates($startdate, $enddate);
     $partners = Partner::all();
     $request->flash();
     $cardTypes = ['AMEX', 'JBC', 'Visa', 'Mastercard', 'BDO Card', 'Express Net', 'Megalink', 'BancNet', 'BPI'];
     return view('reservations.index', compact('calendar', 'roomTypes', 'dates', 'startdate', 'enddate', 'reservation', 'partners', 'cardTypes'));
 }