public function show($slugParent, $slug)
 {
     $destinationDetails = Destinations::where('alias', $slug)->first();
     $title = $destinationDetails->title;
     $id = $destinationDetails->jos_estateagent_town_id;
     $destinationMainImage = $destinationDetails->getMainDestinationImage($id);
     return view('destinations.show', compact('destinationDetails', 'title', 'destinationMainImage'));
 }
Example #2
0
 public function getDestinationURL($id)
 {
     $findRow = Destinations::find($id);
     $findParent = $findRow->parent;
     if ($findParent == 0) {
         $urlDestination = asset('/') . Lang::get('slugs.destinations') . "/" . $findRow->alias . "/" . $findRow->alias;
     } else {
         $findParentRow = Destinations::find($findParent);
         $urlDestination = asset('/') . Lang::get('slugs.destinations') . "/" . $findParentRow->alias . "/" . $findRow->alias;
     }
     return $urlDestination;
 }
 public function destinationMarkers()
 {
     $destinationDetails = Destinations::where('active', '=', 1)->where('isDomestic', '=', '1')->get();
     foreach ($destinationDetails as $locations) {
         $lat = $locations['GLat'];
         $lng = $locations['GLng'];
         $values = array('location_latitude' => $lat, 'location_longitudeng' => $lng, 'name' => $locations['title']);
         //$values =  utf8_encode(json_encode(array("Apple", "Banana", "Pear")));
         $rows[] = $values;
     }
     return view('destinations.partials.test', compact('rows'));
 }
Example #4
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'));
 }
Example #5
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $unit = new Units();
     if (Input::has("list") && Input::get('list') == 'Last') {
         return Redirect::route('list', Request::all());
     }
     if (Input::has("list") && Input::get('list') == 'First') {
         return Redirect::route('list', Request::all());
     }
     $checkin = Lang::get('lang.CheckIn');
     $checkout = Lang::get('lang.CheckOut');
     $pagination = config('constants.PAGINATION');
     $param_Destination = "";
     $param_Category = "";
     $paramCat = "";
     $param_Price = "";
     $paramSearch = "";
     $paramNrPersons = "";
     $paramOrder = "";
     $checkInDate = "";
     $checkOutDate = "";
     $allParameters = Request::all();
     $allSearchParameters = Request::only('destination', 'start', 'end', 'nr_persons');
     $allMainCategoryParams = array();
     if (isset($allParameters['private'])) {
         $allMainCategoryParams[] = Config::get('constants.MAIN_HOUSE_CATEGORIES.PRIVATE');
     }
     if (isset($allParameters['hotel'])) {
         $allMainCategoryParams[] = Config::get('constants.MAIN_HOUSE_CATEGORIES.HOTEL');
     }
     if (isset($allParameters['hostel'])) {
         $allMainCategoryParams[] = Config::get('constants.MAIN_HOUSE_CATEGORIES.HOSTEL');
     }
     //kreiranje arraya za property type filtere
     $unitCat1 = array();
     $unitCat = array();
     if (isset($allParameters['apartment'])) {
         $unitCat1[] = Config::get('constants.MAIN_UNIT_CATEGORIES.APARTMENT');
     }
     if (isset($allParameters['room'])) {
         $unitCat1[] = Config::get('constants.MAIN_UNIT_CATEGORIES.ROOM');
     }
     if (isset($allParameters['house'])) {
         $unitCat1[] = Config::get('constants.MAIN_UNIT_CATEGORIES.VACATION_HOUSE');
     }
     if (count($unitCat1) != 0) {
         $unitCat = call_user_func_array('array_merge', $unitCat1);
     }
     //pretvara url parametre u pripadajuće kolumne u bazi
     $allUnitParameters = Request::only('acc_type', 'rooms', 'baths', 'seaview', 'parking', 'wifi', 'air', 'tv', 'pets', 'access', 'cot', 'balcony', 'grill', 'dryer', 'wash', 'heating');
     $changedUnitKeysToDB = array("acc_type" => "cat", "rooms" => "rooms", "baths" => "wc", "seview" => "seview", "parking" => "parkinginclude", "wifi" => "dslinclude", "air" => "airinclude", "tv" => "tv", "pets" => "petsinclude", "access" => "handicap", "cot" => "little_bed", "balcony" => "balcony", "grill" => "fireside", "dryer" => "hairdryer", "wash" => "washing", "heating" => "toheat_ufloor");
     $allChangedUnitParameters = getKeyArray($allUnitParameters, $changedUnitKeysToDB);
     $onlyUnitParams = array();
     foreach ($allChangedUnitParameters as $key => $value) {
         if ($value > 0) {
             $onlyUnitParams[$key] = $value;
         }
     }
     $allPrivateAndHotelParameters = Request::only('pool', 'food');
     $pool = 0;
     if (isset($allPrivateAndHotelParameters['pool'])) {
         $pool = $allPrivateAndHotelParameters['pool'];
     }
     $food = 0;
     if (isset($allPrivateAndHotelParameters['food'])) {
         $food = $allPrivateAndHotelParameters['food'];
     }
     $allHouseParameters = Request::only('boat', 'berth');
     $boat = 0;
     if (isset($allHouseParameters['boat'])) {
         $boat = $allHouseParameters['boat'];
     }
     $berth = 0;
     if (isset($allHouseParameters['berth'])) {
         $berth = $allHouseParameters['berth'];
     }
     $allDestinationChildren = array();
     if (Input::has("destination") && Input::get('destination') > 0 && $unit->checkDestinationExist(Input::get('destination')) > 0) {
         $param_Destination = Input::get('destination');
         $houseDestinationDestinations = Destinations::where('jos_estateagent_town_id', $param_Destination)->first();
         if ($houseDestinationDestinations->parent > 0) {
             $param_Destination = Input::get('destination');
             $allDestinationChildren[] = Input::get('destination');
         } elseif ($houseDestinationDestinations->parent == 0) {
             $param_Destination = Input::get('destination');
             $param_AllchildDestinations = Destinations::getAllChildren($param_Destination);
             foreach ($param_AllchildDestinations as $child) {
                 $allDestinationChildren[] = $child->jos_estateagent_town_id;
             }
         }
     }
     if (isset($allParameters['start']) && isset($allParameters['end']) && $allParameters['end'] > $allParameters['start'] && $allParameters['start'] != 'Check+In' && $allParameters['end'] != 'Check+Out') {
         $checkInDate = getDBDate($allParameters['start']);
         $checkOutDate = getDBDate($allParameters['end']);
     }
     if (Input::has("start") && Input::get('end') != '') {
         $paramNrPersons = Input::get('nr_persons');
         $paramOrder = 'nr_persons';
     }
     if (Input::has("nr_persons") && Input::get('nr_persons') != '') {
         $paramNrPersons = Input::get('nr_persons');
         $paramOrder = 'nr_persons';
     }
     if (Input::has("q") && Input::get('q') != '') {
         $paramSearch = Input::get('q');
     }
     if (Input::has("acc_type") && Input::get('acc_type') > 0) {
         $param_Category = Input::get('acc_type');
     }
     if (Input::has("cat") && Input::get('cat') > 0) {
         $paramCat = Input::get('cat');
     }
     if (Input::has("rooms") && Input::get('rooms') > 0) {
         $paramOrder = 'rooms';
     }
     if (Input::has("sort")) {
         $param_Price = Input::get('sort');
     }
     list($meta_title, $meta_description) = $unit->getUnitsSearchMeta($param_Destination, $param_Category, $paramCat);
     //ako ima pretraživanje po searchu (q parametar)
     if ($paramSearch != '') {
         $allUnits = Units::search($paramSearch)->published()->whereHas('house', function ($query2) {
             $query2->published()->statusNot('Izvan pretrage');
         })->whereHas('house', function ($query3s) use($allDestinationChildren, $param_Destination) {
             if ($param_Destination > 0) {
                 $query3s->wherein('town_id', $allDestinationChildren);
             }
         })->with('unitPrice')->groupBy('id')->paginate($pagination);
         $allUnits->setPath('units');
     } else {
         $allUnits = Units::published()->where(function ($query) use($onlyUnitParams, $paramNrPersons) {
             foreach ($onlyUnitParams as $key => $value) {
                 if ($value > 0 && $key != 'rooms' && $key != 'wc') {
                     $query->where($key, $value);
                 } elseif ($value > 0 && ($key == 'rooms' || $key == 'wc')) {
                     $query->where($key, '>=', $value);
                 }
             }
             if ($paramNrPersons > 0) {
                 $query->whereRaw('person_berth + person_adjusts_berths BETWEEN ? AND ?+4', [$paramNrPersons, $paramNrPersons]);
             }
         })->where(function ($query) use($unitCat) {
             if (count($unitCat) > 0) {
                 $query->wherein('cat', $unitCat);
             }
         })->where(function ($query) use($food) {
             if ($food > 0) {
                 $query->hasFood();
             }
         })->where(function ($query) use($pool) {
             if ($pool > 0) {
                 $query->hasPool();
             }
         })->whereHas('house', function ($query2) {
             $query2->published()->statusNot('Izvan pretrage');
         })->whereHas('house', function ($query3s) use($allDestinationChildren, $param_Destination) {
             if ($param_Destination > 0) {
                 $query3s->wherein('town_id', $allDestinationChildren);
             }
         })->whereHas('house', function ($query3s) use($paramCat) {
             if ($paramCat > 0) {
                 $query3s->where('jos_estateagent_house_category_id', $paramCat);
             }
         })->whereHas('house', function ($query) use($boat) {
             if ($boat > 0) {
                 $query->hasBoat();
             }
         })->whereHas('house', function ($query) use($berth) {
             if ($berth > 0) {
                 $query->hasBerth();
             }
         })->whereHas('house', function ($query) use($allMainCategoryParams) {
             if (count($allMainCategoryParams) > 0) {
                 $query->wherein('jos_estateagent_main_categories_id', $allMainCategoryParams);
             }
         })->whereDoesntHave('unitCalendar.unitReservation', function ($query) use($checkInDate, $checkOutDate) {
             $query->where('date_to', '>', $checkInDate)->where('date_from', '<', $checkOutDate)->orWhere('date_to', '<', $checkInDate)->where('date_from', '>', $checkOutDate);
         })->with('unitPrice')->ordered($paramOrder)->paginate($pagination);
         $allUnits->setPath('units');
     }
     return view('accommodation.accommodation', compact('allUnits', 'meta_title', 'meta_description', 'allParameters', 'checkin', 'checkout', 'allSearchParameters'));
 }
Example #6
0
 public function getFullDestination($town_id)
 {
     $parentDestination = "";
     $destination = "";
     $findRow = Destinations::find($town_id);
     $findParent = $findRow->parent;
     if ($findParent == 0) {
         $parentDestination = "";
         $destination = getTranslate($town_id, 'jos_estateagent_town', 'title', Lang::locale())->value;
     } else {
         $findParentRow = Destinations::find($findParent);
         $parentDestination = getTranslate($findParentRow, 'jos_estateagent_town', 'title', Lang::locale())->value;
         $destination = getTranslate($town_id, 'jos_estateagent_town', 'title', Lang::locale())->value;
     }
     return array($parentDestination, $destination);
 }
 public function destinations($view)
 {
     $view->with('destinations', Destinations::published()->orderBy('parent')->orderBy('ordering')->with('children')->get());
 }
Example #8
0
 /**
  * Register the application services.
  *
  * @return void
  */
 public function compose($view)
 {
     $view->with('showOnMenu', Destinations::published()->onlyParent()->orderBy('ordering')->with('children')->get());
 }