Exemplo n.º 1
0
 public function countCategoriesUnits($category_id)
 {
     $allCategoriesUnits = Units::published()->whereHas('house', function ($query2) {
         $query2->published()->statusNot('Izvan pretrage');
     })->whereHas('house', function ($query3s) use($category_id) {
         $query3s->where('jos_estateagent_house_category_id', $category_id);
     })->get();
     return count($allCategoriesUnits);
 }
Exemplo n.º 2
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($alias)
 {
     $aliasLang = 'alias' . getLangAlias(Lang::locale());
     $houseDetails = Houses::where($aliasLang, $alias)->first();
     list($apartments, $rooms, $houses, $countpersons) = $houseDetails->countUnitsInHouse($houseDetails->id);
     if ($houseDetails->destination->parent == 0) {
         $destinationName = getTranslate($houseDetails->town_id, 'jos_estateagent_town', 'title', Lang::locale())->value;
         $parentDestinationName = "";
     } else {
         $destinationName = getTranslate($houseDetails->town_id, 'jos_estateagent_town', 'title', Lang::locale())->value;
         $parentDestinationName = getTranslate($houseDetails->destination->parent, 'jos_estateagent_town', 'title', Lang::locale())->value;
     }
     $title = $houseDetails->name;
     $meta_title = $houseDetails->getHouseTitleName($houseDetails->jos_estateagent_house_title_id) . ' ' . $houseDetails->name;
     if ($parentDestinationName != '') {
         $meta_title .= ' | ' . $parentDestinationName;
     }
     $meta_title .= ' | ' . $destinationName . ' | ' . $houseDetails->getHouseTitleName($houseDetails->jos_estateagent_house_title_id) . ' ' . $houseDetails->name;
     $meta_description = Lang::get('lang.MetaDescriptionPrivateURL');
     if (getTranslate($houseDetails->id, 'jos_estateagent_house', 'description', Lang::locale())->value != '') {
         $meta_description .= getTranslate($houseDetails->id, 'jos_estateagent_house', 'description', Lang::locale())->value;
     } else {
         if (getTranslate($houseDetails->id, 'jos_estateagent_house', 'description', Lang::locale())->value != '') {
             $meta_description .= getTranslate($houseDetails->id, 'jos_estateagent_house', 'description', Lang::locale())->value;
         } else {
             $meta_description .= getTranslate($houseDetails->town_id, 'jos_estateagent_town', 'description', Lang::locale())->value;
         }
     }
     $meta_description_all = strip_tags(shorttext($meta_description, 120));
     $description = getTranslate($houseDetails->id, 'jos_estateagent_house', 'description', Lang::locale())->value;
     $houseImages = Houses::find($houseDetails->id)->HouseImages;
     if ($houseImages->isEmpty()) {
         $houseMainImage = "nophoto.jpg";
     } else {
         $houseMainImage = Houses::find($houseDetails->id)->HouseImages()->first()->fname;
     }
     $ownerTours = $houseDetails->owner->getOwnerTours($houseDetails->jos_users_id);
     $getCategoryLinks = Destinations::find($houseDetails->town_id)->DestinationCategoryLinks;
     $categoryTitleLang = "jos_estateagent_town_category_links_" . Lang::locale();
     $getLinks = Destinations::find($houseDetails->town_id)->DestinationLinks->where('jos_estateagent_town_links_publish', 1);
     $titleLang = "jos_estateagent_town_links_title_" . Lang::locale();
     $linkLang = "jos_estateagent_town_links_url_" . Lang::locale();
     $labelColor = array('label-warning', 'label-info', 'label-danger', 'label-success');
     $allDestinationTours = $houseDetails->destination->allDestinationTours($houseDetails->town_id);
     $allUnits = Units::published()->where('jos_estateagent_object_id', $houseDetails->id)->with('unitPrice')->orderBy('redoslijed')->get();
     return view('accommodation.show-house', compact('houseDetails', 'houseMainImage', 'houseImages', 'parentDestinationName', 'destinationName', 'description', 'meta_title', 'meta_description_all', 'apartments', 'rooms', 'houses', 'countpersons', 'allUnits', 'ownerTours', 'getCategoryLinks', 'getLinks', 'titleLang', 'linkLang', 'categoryTitleLang', 'labelColor', 'allDestinationTours'));
 }
Exemplo n.º 3
0
 public function countUnitsInHouse($house_id)
 {
     $allUnits = Units::published()->where('jos_estateagent_object_id', $house_id)->get();
     $apartments = Config::get('constants.MAIN_UNIT_CATEGORIES.APARTMENT');
     $rooms = Config::get('constants.MAIN_UNIT_CATEGORIES.ROOM');
     $houses = Config::get('constants.MAIN_UNIT_CATEGORIES.VACATION_HOUSE');
     $countApartments = 0;
     $countRooms = 0;
     $countHouses = 0;
     $countPersons = 0;
     foreach ($allUnits as $unit) {
         $countPersons += $unit->person_berth + $unit->person_adjusts_berths;
         if (in_array($unit->cat, $apartments)) {
             $countApartments = Units::published()->where('jos_estateagent_object_id', $house_id)->whereIn('cat', $apartments)->count();
         } elseif (in_array($unit->cat, $rooms)) {
             $countRooms = Units::published()->where('jos_estateagent_object_id', $house_id)->whereIn('cat', $rooms)->count();
         } elseif (in_array($unit->cat, $houses)) {
             $countHouses = Units::published()->where('jos_estateagent_object_id', $house_id)->whereIn('cat', $houses)->count();
         }
     }
     return array($countApartments, $countRooms, $countHouses, $countPersons);
 }
Exemplo n.º 4
0
 public function discounts()
 {
     $pagination = config('constants.PAGINATION');
     $checkin = Lang::get('lang.CheckIn');
     $checkout = Lang::get('lang.CheckOut');
     $param_Price = "";
     $lastOrFirstMinute = "";
     $allParameters = Request::all();
     if (Input::has("sort")) {
         $param_Price = Input::get('sort');
     }
     if (Input::has("list")) {
         $param_list = Input::get('list');
         if ($param_list == "Last") {
             $lastOrFirstMinute = "Last Minute";
         } elseif ($param_list == "First") {
             $lastOrFirstMinute = "First Minute";
         } else {
             $lastOrFirstMinute = "";
         }
     }
     $allUnits = Units::published()->has('unitDiscount')->whereHas('unitDiscount', function ($query2) use($lastOrFirstMinute) {
         $query2->where('discount', $lastOrFirstMinute);
     })->whereHas('house', function ($query2) {
         $query2->published()->statusNot('Izvan pretrage');
     })->with('unitPrice')->paginate($pagination);
     $allUnits->setPath('units');
     return view('accommodation.discounts', compact('allUnits', 'allParameters', 'checkin', 'checkout'));
 }
Exemplo n.º 5
0
 public function countAllDestinationUnits($town_id)
 {
     $allDestinations = array();
     $allchildDestinations = $this->getAllChildren($town_id);
     foreach ($allchildDestinations as $child) {
         $allDestinations[] = $child->jos_estateagent_town_id;
     }
     $allUnits = Units::published()->whereHas('house', function ($query2) {
         $query2->published()->statusNot('Izvan pretrage');
     })->whereHas('house', function ($query3s) use($allDestinations) {
         $query3s->wherein('town_id', $allDestinations);
     })->count();
     return $allUnits;
 }