public function getSearchAll(Request $request) { $result['estadoEscogido'] = null; $entidad = new entidadTuristica(); if ($request['estado'] != "T") { $result['estadoEscogido'] = estados::where('id', $request['estado'])->first(); } //Servicios $valoracion = new valoracion(); $servs = new servicios(); $nombreFotos = $servs->nombreFotos(); $nombres = $servs->nombres(); $array_keys = (array) $servs['fillable']; unset($array_keys[12]); //--------- $fecha = Carbon::now(); //filtros de servicios if (Session::has('serviociohabitacion')) { $request['serviociohabitacion'] = Session::get('serviociohabitacion'); } if (Session::has('spa')) { $request['spa'] = Session::get('spa'); } if (Session::has('wifi')) { $request['wifi'] = Session::get('wifi'); } if (Session::has('playa')) { $request['playa'] = Session::get('playa'); } if (Session::has('restaurante')) { $request['restaurante'] = Session::get('restaurante'); } if (Session::has('piscina')) { $request['piscina'] = Session::get('piscina'); } if (Session::has('peluqueria')) { $request['peluqueria'] = Session::get('peluqueria'); } if (Session::has('lavanderia')) { $request['lavanderia'] = Session::get('lavanderia'); } if (Session::has('gimnasio')) { $request['gimnasio'] = Session::get('gimnasio'); } if (Session::has('discoteca')) { $request['discoteca'] = Session::get('discoteca'); } if (Session::has('estacionamiento')) { $request['estacionamiento'] = Session::get('estacionamiento'); } if (Session::has('ascensor')) { $request['ascensor'] = Session::get('ascensor'); } //filtros generales if (Session::has('motivo')) { $request['motivo'] = Session::get('motivo'); } else { Session::set('motivo', $request['motivo']); } //filtros generales if (Session::has('estrellas')) { $request['estrellas'] = Session::get('estrellas'); } else { Session::set('estrellas', $request['estrellas']); } if (Session::has('estado')) { $request['estado'] = Session::get('estado'); } else { Session::set('estado', $request['estado']); } if (Session::has('tarifa')) { $request['tarifa'] = Session::get('tarifa'); } else { Session::set('tarifa', "0;200000"); } if (Session::has('capacidad')) { $request['capacidad'] = Session::get('capacidad'); } else { Session::set('capacidad', "0;10"); } if (Session::has('fecha')) { $request['fecha'] = Session::get('fecha'); } else { Session::set('fecha', $fecha->toDateString() . ' - ' . $fecha->toDateString()); } if (Session::has('tipo')) { $request['tipo'] = Session::get('tipo'); } else { Session::set('tipo', 'T'); } //if(Session::has('idestado')) $request['idestado'] = Session::get('idestado'); else Session::set('idestado', 'T'); if (Session::has('idciudad')) { $request['idciudad'] = Session::get('idciudad'); } else { Session::set('idciudad', 'T'); } if (Session::has('estado')) { $request['estado'] = Session::get('estado'); } else { Session::set('estado', $request['estado']); } if (!Session::has('searchAll')) { Session::set('searchAll', 'true'); } //dd(Session::all()); $result['estados'] = estados::all(); if ($request['motivo'] == "1") { $habitaciones = new habitacion(); $request['motivo'] = Session::get('motivo'); $request['estrellas'] = Session::get('estrellas'); $request['estado'] = Session::get('estado'); $request['idestado'] = Session::get('estado'); $request['tarifa'] = Session::get('tarifa'); $request['capacidad'] = Session::get('capacidad'); $request['fecha'] = Session::get('fecha'); $hoteles = $entidad->search($request->all()); //Paginacion $hoteles = $entidad->transformForPaginate($hoteles); $result['pagination'] = $hoteles; $result['hoteles'] = $habitaciones->getTarifas($hoteles); foreach ($result['hoteles'] as $hotel) { $hotel['servicios'] = servicios::where('identidad', $hotel['rif'])->first(); $hotel['valoracion'] = $valoracion->getCalificacion($hotel['rif']); } //servicios $result['array_keys'] = $array_keys; $result['nombreFotos'] = $nombreFotos; $result['nombres'] = $nombres; //---------- return View::make('web.listadoHoteles')->with('result', $result); } else { $request['idestado'] = Session::get('estado'); if (Session::has('idciudad')) { $request['idciudad'] = Session::get('idciudad'); } $result['servicios'] = $entidad->searchEntidad($request->all()); foreach ($result['servicios'] as $servicio) { $servicio['valoracion'] = $valoracion->getCalificacion($servicio['rif']); } return View::make('web.listadoEntidades')->with('result', $result); } }