public function resorts() { $idPageResorts = 6; $page = Page::resort($this->resortId)->active()->id($idPageResorts)->with(['contents' => function ($query) { $query->where('lang_id', '=', $this->langId); }])->first(); if ($page) { $page = $page->contents->first(); $idCancun = 1; $idRivieraMaya = 2; $idPlayaDelCarmen = 3; $destination1 = Destination::active()->id($idCancun)->with(['contents' => function ($query) { $query->select('destination_contents.destination_id', 'destination_contents.short_description', 'destination_contents.alt1'); $query->where('lang_id', '=', $this->langId); }])->with(['resorts.contents' => function ($query) { $query->select('resort_contents.resort_id', 'resort_contents.short_description', 'resort_contents.short_offer', 'resort_contents.alt1'); $query->where('lang_id', '=', $this->langId); }])->first(); $destination2 = Destination::active()->id($idRivieraMaya)->with(['contents' => function ($query) { $query->select('destination_contents.destination_id', 'destination_contents.short_description', 'destination_contents.alt1'); $query->where('lang_id', '=', $this->langId); }])->with(['resorts.contents' => function ($query) { $query->select('resort_contents.resort_id', 'resort_contents.short_description', 'resort_contents.short_offer', 'resort_contents.alt1'); $query->where('lang_id', '=', $this->langId); }])->first(); $destination3 = Destination::active()->id($idPlayaDelCarmen)->with(['contents' => function ($query) { $query->select('destination_contents.destination_id', 'destination_contents.short_description', 'destination_contents.alt1'); $query->where('lang_id', '=', $this->langId); }])->with(['resorts.contents' => function ($query) { $query->select('resort_contents.resort_id', 'resort_contents.short_description', 'resort_contents.short_offer', 'resort_contents.alt1'); $query->where('lang_id', '=', $this->langId); }])->first(); //return dd($destination3->toArray()); return View('pages.resorts', compact('page', 'destination1', 'destination2', 'destination3')); } }
public function resorts() { $idPageResorts = 39; //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($idPageResorts)->with(['contents' => function ($query) { $query->where('lang_id', '=', $this->langId); }])->first(); if ($page) { $page = $page->contents->first(); $idStMaarten = 5; //este id es el id del destindo en la tabla destinatios $idCuracao = 6; //este id es el id del destindo en la tabla destinatios $destination1 = Destination::active()->id($idStMaarten)->with(['contents' => function ($query) { $query->select('destination_contents.destination_id', 'destination_contents.short_description', 'destination_contents.alt1'); $query->where('lang_id', '=', $this->langId); }])->with(['resorts.contents' => function ($query) { $query->select('resort_contents.resort_id', 'resort_contents.short_description', 'resort_contents.short_offer', 'resort_contents.alt1'); $query->where('lang_id', '=', $this->langId); }])->first(); $destination2 = Destination::active()->id($idCuracao)->with(['contents' => function ($query) { $query->select('destination_contents.destination_id', 'destination_contents.short_description', 'destination_contents.alt1'); $query->where('lang_id', '=', $this->langId); }])->with(['resorts.contents' => function ($query) { $query->select('resort_contents.resort_id', 'resort_contents.short_description', 'resort_contents.short_offer', 'resort_contents.alt1'); $query->where('lang_id', '=', $this->langId); }])->first(); //return dd($destination3->toArray()); return View('pages.resorts', compact('page', 'destination1', 'destination2')); } }