public function activityShow() { $idPageActivities = 58; $page = Page::resort($this->resortId)->active()->id($idPageActivities)->with(['contents' => function ($query) { $query->where('lang_id', '=', $this->langId); }])->first(); if ($page) { $page = $page->contents->first(); $identifier = Page::find($idPageActivities); //return dd($identifier->toArray()); return View('pages.activitySingle', compact('page', 'identifier')); } }
public function offers() { $idHomeOffers = 8; $page = Page::resort($this->resortId)->active()->id($idHomeOffers)->with(['contents' => function ($query) { $query->where('lang_id', '=', $this->langId); }])->first(); if ($page) { $page = $page->contents->first(); if (Agent::isMobile()) { $offers = Offer::active()->range()->whereHas('resorts', function ($q) { $q->where('id', $this->resortId); })->whereHas('websites', function ($q) { $q->where('id', $this->website_id); })->with(['contents' => function ($query) { $query->where('lang_id', '=', $this->langId); }])->orderBy('priority', 'desc')->get(); } else { $offers = Offer::active()->range()->whereHas('websites', function ($q) { $q->where('id', $this->website_id); })->whereHas('resorts', function ($q) { $q->where('id', $this->resortId); })->with(['contents' => function ($query) { $query->where('lang_id', '=', $this->langId); }])->where('mobile_only', 0)->orderBy('priority', 'desc')->get(); } $packages = Package::active()->with(['contents' => function ($query) { $query->where('lang_id', '=', $this->langId); }])->orderBy('priority', 'desc')->get(); //return dd($packages->toArray()); return View('pages.offers', compact('page', 'offers', 'packages')); } else { App::abort(404); } }
public function offers() { $idHomeOffers = 41; //este id es el id de la pagina en la base de datos en la tabla page con campo id $page = Page::resort($this->resortId)->active()->id($idHomeOffers)->with(['contents' => function ($query) { $query->where('lang_id', '=', $this->langId); }])->first(); if ($page) { $page = $page->contents->first(); if (Agent::isMobile()) { $offers = Offer::active()->range()->whereHas('resorts', function ($q) { $q->where('id', $this->resortId); })->whereHas('contents', function ($q) { $q->where('lang_id', $this->langId); })->with(['contents' => function ($query) { $query->where('lang_id', '=', $this->langId); }])->orderBy('priority', 'desc')->get(); } else { $offers = Offer::active()->range()->whereHas('resorts', function ($q) { $q->where('id', $this->resortId); })->whereHas('contents', function ($q) { $q->where('lang_id', $this->langId); })->with(['contents' => function ($query) { $query->where('lang_id', '=', $this->langId); }])->where('mobile_only', 0)->orderBy('priority', 'desc')->get(); } //return dd($offers); return View('pages.offers', compact('page', 'offers')); } else { App::abort(404); } }