public function dining() { $idPageDining = 4; $page = Page::resort($this->resortId)->active()->id($idPageDining)->with(['contents' => function ($query) { $query->where('lang_id', '=', $this->langId); }])->first(); if ($page) { $page = $page->contents->first(); $dinings = Dining::with(['contents' => function ($query) { $query->where('lang_id', '=', $this->langId); }])->where('resort_id', $this->resortId)->get(); //return dd($dinings->toArray()); return View('pages.dining', compact('page', 'dinings')); } }
public function dining() { $idPageDining = 37; //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($idPageDining)->with(['contents' => function ($query) { $query->where('lang_id', '=', $this->langId); }])->first(); if ($page) { $page = $page->contents->first(); $dinings = Dining::with(['contents' => function ($query) { $query->where('lang_id', '=', $this->langId); }])->where('resort_id', $this->resortId)->get(); //return dd($dinings->toArray()); return View('pages.dining', compact('page', 'dinings')); } }