public function getHome() { $data['tipo_publicaciones'] = TipoPublicacion::where('tipo_publicaciones.ind_visible', '=', 1)->orderBy('tipo_publicaciones.orden', 'asc')->get(); foreach ($data['tipo_publicaciones'] as $tipo_publicacion) { $data[strtolower($tipo_publicacion->descripcion)] = $tipo_publicacion->contenidos()->where('contenidos.ind_visible', '=', 1)->whereNotNull('contenidos.fondo')->whereDate('fecha_vigencia', '>=', Carbon::today()->toDateString())->get(); } return view('pages.home', $data); }