Beispiel #1
0
 private function getDisabledDates()
 {
     $dates = \DB::table('bookings')->where('id_property', session('current_property')->id)->lists('check_out', 'check_in');
     $disabledDates = array();
     foreach ($dates as $checkIn => $checkOut) {
         $disabledDates = array_merge($disabledDates, DateHelper::date_range($checkIn, $checkOut));
     }
     return $disabledDates;
 }
Beispiel #2
0
 public function getTotalPriceAttribute()
 {
     $dateRange = DateHelper::date_range($this->check_in, $this->check_out);
     $totalPrice = 0;
     $weekendPrice = $this->rate->weekend_price;
     $weekdayPrice = $this->rate->weekday_price;
     foreach ($dateRange as $date) {
         if (DateHelper::isWeekend($date)) {
             $totalPrice += $weekendPrice;
         } else {
             $totalPrice += $weekdayPrice;
         }
     }
     $services = $this->roomType->servicePlans->services;
     if ($services !== null) {
         foreach ($services as $service) {
             $totalPrice += $service->price;
         }
     }
     return $totalPrice;
 }