public function filterTransaction()
 {
     $rType = Input::get('rType');
     $sType = Input::get('sType');
     $response = array();
     if (empty($sType) && !empty($rType)) {
         $transactions = CottageReservation::where('reservation_type', '=', $rType)->get();
     } elseif (!empty($sType) && !empty($rType)) {
         $transactions = CottageReservation::where('reservation_type', '=', $rType)->where('status', '=', $sType)->get();
     } else {
         $transactions = CottageReservation::where('status', '=', $sType)->get();
     }
     foreach ($transactions as $transaction) {
         $roomname = Room::where('rnid', '=', $transaction['room_id'])->first();
         $userInfo = UserInfo::where('user_id', '=', $transaction['user_id'])->first();
         $reservation_type = ReservationType::find($transaction['reservation_type'])->first();
         if ($transaction['reservation_type'] == "1") {
             if ($transaction['day_type'] == 1) {
                 $time = "Morning";
             } else {
                 $time = "Overnight";
             }
         } else {
             $time = date("g:i a", strtotime($transaction['check_in_datetime']));
         }
         //cottage list
         /*
                     $cottagelists = explode(",", $transaction['cottagelist_id']);
                     foreach($cottagelists as $list)
                     {
                     	$cottagename = CottageList::where('cottagelist_id','=',$list)->first();
                     	
                     	
                     	
                     	if(!in_array($cottagename['cottagename'], $cottagelists))
         				{
         					$a[count($cottagelists)] = $cottagename['cottagename'];
         				}
                     }*/
         $all = CottageList::all();
         $cottagelists = explode(",", $transaction['cottagelist_id']);
         $cottagelists2 = array();
         foreach ($all as $cottagename) {
             if (in_array($cottagename['cottagelist_id'], $cottagelists)) {
                 $cottagelists2[count($cottagelists2)] = $cottagename['cottagename'] . "<br>";
             }
         }
         $a = $cottagelists2;
         $response[] = array("id" => $transaction['id'], "fname" => $userInfo['firstname'], "lname" => $userInfo['lastname'], "rtpe" => $reservation_type['name'], "rdate" => $transaction['reservation_date'], "status" => $transaction['status'], "room_name" => !empty($roomname) ? $roomname['roomname'] : "", "cottage_name" => $a, "ttime" => $time);
     }
     return $response;
 }
 public function getCottagelist()
 {
     $response = array();
     $cottageType = Input::get('cottageType');
     $date = date('Y-m-d', strtotime(Input::get('date')));
     $month = date('m', strtotime(Input::get('date')));
     $reserves = CottageReservation::where('reservation_date', '=', $date)->get();
     $id = array();
     if (!empty($reserves)) {
         foreach ($reserves as $reserve) {
             $chosenCottages = explode(",", $reserve['cottagelist_id']);
             foreach ($chosenCottages as $cottage) {
                 if (!$cottage == "") {
                     if (!in_array($cottage, $id)) {
                         $id[count($id)] = $cottage;
                     }
                 }
             }
         }
         $weekDay = date('w', strtotime($date));
         $holidayCheck = Holidays::where('date', '=', $date)->first();
         //return count($holidayCheck);
         if ($month == 03 || $month == 04 || $month == 05) {
             $details = "Summer Season";
             $season = 3;
         } elseif (!empty($holidayCheck)) {
             $details = $holidayCheck['holidays'];
             $season = 2;
         } elseif ($weekDay == 0 || $weekDay == 6) {
             $details = "Weekend";
             $season = 2;
         } else {
             $details = "Regular Season";
             $season = 1;
         }
         /*
         			$response[] = array(
         			"cottage_list"=>'',
         			"name"	=>'',
         			"details"=>$details,
         			"season"	=>$season,
         			);*/
         $cottagelists = CottageList::where('cottage_id', '=', $cottageType)->get();
         foreach ($cottagelists as $list) {
             if (!in_array($list['cottagelist_id'], $id)) {
                 $response[] = array("cottage_list" => $list['cottagelist_id'], "name" => $list['cottagename'], "details" => $details, "season" => $season);
             }
         }
         return $response;
     } else {
         $getCottage_lists = CottageList::where('cottage_id', '=', $cottageType)->get();
         foreach ($getCottage_lists as $list) {
             $response[] = array("cottage_list" => $list['cottagelist_id'], "name" => $list['cottagename']);
         }
         return $response;
     }
 }