->join('category_hotel', 'categories.id', '=', 'category_hotel.category_id') ->join('hotels', 'category_hotel.hotel_id', '=', 'hotels.id') ->where('hotels.main_city_id', '=', $thisMainCityId) ->join('sub_cities', 'hotels.sub_city_id', '=', 'sub_cities.id') ->orderBy('sub_cities.name', 'ASC') ->groupBy('sub_cities.name') ->select('sub_cities.name', 'sub_cities.id') ->get(); }else if(isset($_GET['isMain']) && $_GET['isMain'] == 'noMain'){ //by category and sub city $sPlace = urldecode(urldecode($_GET['subCity'])); $sPlace = explode('-', $sPlace); $sPlace = implode(' ', $sPlace); $inCity = $sPlace; $thisSubCity = $subCity->where('name', '=', $sPlace)->first(); $thisSubCityId = isset($thisSubCity->id) ? $thisSubCity->id : -1; $hotelsList = $category->where('categories.seo_name', '=', $type) ->join('category_hotel', 'categories.id', '=', 'category_hotel.category_id') ->join('hotels', 'category_hotel.hotel_id', '=', 'hotels.id') ->where('hotels.sub_city_id', '=', $thisSubCityId) ->orderBy('hotels.id', 'DESC') ->skip(0) ->take(30) ->get(); $hotelsListCount = $category->where('categories.seo_name', '=', $type) ->join('category_hotel', 'categories.id', '=', 'category_hotel.category_id') ->join('hotels', 'category_hotel.hotel_id', '=', 'hotels.id') ->where('hotels.sub_city_id', '=', $thisSubCityId) ->orderBy('hotels.id', 'DESC') ->count();
<?php define('_MEXEC', 'OK'); require_once($_SERVER['DOCUMENT_ROOT'] . "/config/app.php"); if(!isset($_POST['value']) || $_POST['value'] != '437d04d169b9b9a592f944802c6b3c39'){ die('Try again.'); } $string = isset($_POST['key']) ? $_POST['key'] : ''; if(strlen($string) < 1){ die(false); } $quaries = ['c' => [], 'h' => [], 'd' => []]; $objC = new SubCity(); $list1 = $objC->where('name', 'like', '%' . $string . '%') ->take(7) ->get(['name']); foreach($list1 as $list1Val){ $quaries['c'][] = $list1Val->name; } $objH = new Hotel(); $list2 = $objH->where('name', 'like', '%' . $string . '%')->take(7)->get(['name']); foreach($list2 as $list2Val){ $quaries['h'][] = $list2Val->name; } $objD = new Destination(); $list3 = $objD->where('destination', 'like', '%' . $string . '%') ->take(7) ->get(['destination']); foreach($list3 as $list3Val){ $quaries['d'][] = $list3Val->destination; }
if(!isset($_GET['subCity']) || (strlen($_GET['subCity']) < 1)){ //by main city $hotelsList = $mainCity->where('main_cities.name', '=', $mPlace) ->join('hotels', 'main_cities.id', '=', 'hotels.main_city_id') ->orderBy('hotels.id', 'DESC') ->skip(0) ->take(30) ->get(); }else if(isset($_GET['subCity']) && (strlen($_GET['subCity']) > 0)){ //by main city then sub city $city = urldecode($_GET['subCity']); $city = str_replace('-', ' ', $city); $title .= ' | ' . ucwords($city); $bCrumb .= ' > ' . ucwords($city); $thisSubCity = $subCity->where('name', '=', $city)->first(); $thisSubCityId = isset($thisSubCity->id) ? $thisSubCity->id : -1; $hotelsList = $mainCity->where('main_cities.name', '=', $mPlace) ->join('hotels', 'main_cities.id', '=', 'hotels.main_city_id') ->where('hotels.sub_city_id', '=', $thisSubCityId) ->orderBy('hotels.id', 'DESC') ->skip(0) ->take(30) ->get(); }else{ $hotelsList = []; } ?> <!DOCTYPE> <html> <?php require_once(DOC_ROOT . 'includes/head.php'); ?>