Пример #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);
 }
Пример #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'));
 }
Пример #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);
 }
Пример #4
0
 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function show($houseSlug, $id)
 {
     $unitDetails = Units::where('id', $id)->first();
     if ($unitDetails->house->destination->parent == 0) {
         $destinationName = getTranslate($unitDetails->house->town_id, 'jos_estateagent_town', 'title', Lang::locale())->value;
         $parentDestinationName = "";
     } else {
         $destinationName = getTranslate($unitDetails->house->town_id, 'jos_estateagent_town', 'title', Lang::locale())->value;
         $parentDestinationName = getTranslate($unitDetails->house->destination->parent, 'jos_estateagent_town', 'title', Lang::locale())->value;
     }
     $title = $unitDetails->title;
     $meta_title = $unitDetails->house->getHouseTitleName($unitDetails->house->jos_estateagent_house_title_id) . ' ' . $unitDetails->house->name;
     if ($parentDestinationName != '') {
         $meta_title .= ' | ' . $parentDestinationName;
     }
     $meta_title .= ' | ' . $destinationName . ' | ' . $unitDetails->getUnitCategoryName($unitDetails->cat) . ' ' . $unitDetails->title;
     $meta_description = Lang::get('lang.MetaDescriptionPrivateURL');
     if (getTranslate($unitDetails->id, 'jos_estateagent_unit', 'description', Lang::locale())->value != '') {
         $meta_description .= getTranslate($unitDetails->id, 'jos_estateagent_unit', 'description', Lang::locale())->value;
     } else {
         if (getTranslate($unitDetails->house->id, 'jos_estateagent_house', 'description', Lang::locale())->value != '') {
             $meta_description .= getTranslate($unitDetails->house->id, 'jos_estateagent_house', 'description', Lang::locale())->value;
         } else {
             $meta_description .= getTranslate($unitDetails->house->town_id, 'jos_estateagent_town', 'description', Lang::locale())->value;
         }
     }
     $meta_description_all = strip_tags(shorttext($meta_description, 120));
     $description = getTranslate($unitDetails->id, 'jos_estateagent_unit', 'description', Lang::locale())->value;
     $isHotel = FALSE;
     if ($unitDetails->house->jos_estateagent_main_categories_id == Config::get('constants.MAIN_HOUSE_CATEGORIES.HOTEL')) {
         $isHotel = TRUE;
     } else {
         $isHotel = FALSE;
     }
     $add_services = array();
     array_push($add_services, array(0 => "fullboard", 1 => "fullboard_payment", 2 => "Fullboard", 3 => "fullboard_price", 4 => "PerService"));
     array_push($add_services, array(0 => "halfboard", 1 => "halfoard_payment", 2 => "Halfboard", 3 => "halfboard_price", 4 => "PerService"));
     array_push($add_services, array(0 => "bed_breakfast", 1 => "bed_breakfast_payment", 2 => "BedBreakfast", 3 => "bed_breakfast_price", 4 => "PerService"));
     array_push($add_services, array(0 => "dslinclude", 1 => "dsl_payment", 2 => "DSLInternet", 3 => "dslprice", 4 => "PerDay"));
     array_push($add_services, array(0 => "petsinclude", 1 => "pets_payment", 2 => "Pets", 3 => "petsprice", 4 => "PerDay"));
     array_push($add_services, array(0 => "parkinginclude", 1 => "park_payment", 2 => "ParkingPlace", 3 => "parkingprice", 4 => "PerDay"));
     array_push($add_services, array(0 => "airinclude", 1 => "aircondition_payment", 2 => "IconAirCondition", 3 => "airprice", 4 => "PerDay"));
     $negotiableCounterUnit = 0;
     $negotiableStringsUnit = array();
     $priceCounterUnit = 0;
     $priceStringsUnit = array();
     $pricesUnit = array();
     $pricesPerUnit = array();
     foreach ($add_services as $idList) {
         if ($unitDetails->{$idList}[0] == 2 && $unitDetails->{$idList}[1] == 1) {
             $negotiableCounterUnit++;
             $negotiableStringsUnit[] = Lang::get('lang.' . $idList[2]);
         } elseif ($unitDetails->{$idList}[0] == 2 && $unitDetails->{$idList}[1] == 0) {
             $priceCounterUnit++;
             $priceStringsUnit[] = Lang::get('lang.' . $idList[2]);
             $pricesUnit[] = $unitDetails->{$idList}[3];
             $pricesPerUnit[] = $idList[4];
         }
     }
     $add_services_house = array();
     array_push($add_services_house, array(0 => "cleaninginclude", 1 => "cleaning_negotiable", 2 => "FinalCleaning", 3 => "cleaningprice", 4 => "PerService"));
     array_push($add_services_house, array(0 => "towels", 1 => "towel_negotiable", 2 => "Towels", 3 => "towelsprice", 4 => "PerService"));
     array_push($add_services_house, array(0 => "berth", 1 => "berthprice_negotiable", 2 => "BerthUse", 3 => "berthprice", 4 => "PerDay"));
     array_push($add_services_house, array(0 => "boat", 1 => "boat_negotiable", 2 => "BoatUse", 3 => "boatprice", 4 => "PerDay"));
     $negotiableCounter = 0;
     $negotiableStrings = array();
     $priceCounter = 0;
     $priceStrings = array();
     $prices = array();
     $pricesPer = array();
     foreach ($add_services_house as $idList) {
         if ($unitDetails->house->{$idList}[0] == 2 && $unitDetails->house->{$idList}[1] == 1) {
             $negotiableCounter++;
             $negotiableStrings[] = Lang::get('lang.' . $idList[2]);
         } elseif ($unitDetails->house->{$idList}[0] == 2 && $unitDetails->house->{$idList}[1] == 0) {
             $priceCounter++;
             $priceStrings[] = Lang::get('lang.' . $idList[2]);
             $prices[] = $unitDetails->house->{$idList}[3];
             $pricesPer[] = $idList[4];
         }
     }
     $unitMainImage = $unitDetails->getMainUnitImage($unitDetails->id);
     $unitImages = Units::find($id)->UnitImages;
     return view('accommodation.show', compact('unitDetails', 'unitMainImage', 'unitImages', 'parentDestinationName', 'destinationName', 'description', 'meta_title', 'meta_description_all', 'isHotel', 'negotiableCounterUnit', 'negotiableStringsUnit', 'priceCounterUnit', 'priceStringsUnit', 'pricesUnit', 'pricesPerUnit', 'negotiableCounter', 'negotiableStrings', 'priceCounter', 'priceStrings', 'prices', 'pricesPer'));
     //
 }
Пример #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;
 }