public function getImagesForDelete(Request $request, $habitacion, $idHabitacion) { if ($habitacion == "false") { $hab = false; } else { $hab = true; } $habitacion = new habitacion(); $hotel = entidadTuristica::where('rif', Session::get("idEnt"))->first(); if ($hab) { $fotos = $habitacion->getFotos($idHabitacion); } else { $fotos = $hotel->galeria; } $view = View::make('adminHotel.galeria2')->with(["fotos" => $fotos, "habitacion" => $hab]); if ($request->ajax()) { $sections = $view->renderSections(); $response = Response::json(['success' => true, 'data' => $sections['galeria2']], 200); } else { $response = $view; } return $response; }
public function getHabitacionesDetails(Request $request, $id) { $habitacion = new habitacion(); $habitacion = $habitacion->habitacionPorId($id); $habitacion2 = new habitacion(); $fotos = $habitacion2->getFotos($id); $galeria = new galeriaHabitacion(); $habFirst = $habitacion->first(); if ($habFirst->imagen != null) { $idFotoPerfil = $galeria->getFotoID($habFirst->imagen); } else { $idFotoPerfil = null; } //dd($idFotoPerfil); //cosas para servicios $servhab = new habitacion(); $servicios = (array) $habFirst['attributes']; $array_keys = array_keys($servicios); $nombreFotos = $servhab->nombreFotos(); $nombres = $servhab->nombres(); $habitacionesPerfil = habitacionesPerfil::where('idperfilhabitacion', $id)->get(); for ($i = 0; $i < 7; $i++) { unset($array_keys[$i]); } unset($array_keys[23]); unset($array_keys[24]); $camas = camas::where('idhabitacion', $habitacion[0]['id'])->get(); $hab = new habitacion(); $habitacion = $hab->serviciosOrdenados($habitacion); $cam = new camas(); $tipoCamas = $cam->tiposCamas(); $view = View::make('adminHotel.detalles-habitacion')->with(['habitacion' => $habitacion, 'camas' => $camas, 'fotos' => $fotos, 'idFotoPerfil' => $idFotoPerfil, 'servicios' => $servicios, 'array_keys' => $array_keys, 'nombres' => $nombres, 'nombreFotos' => $nombreFotos, "tipoCamas" => $tipoCamas, "habitacionesPerfil" => $habitacionesPerfil]); if ($request->ajax()) { $sections = $view->renderSections(); $response = Response::json(['success' => true, 'data' => $sections['detallesHabitacion']], 200); } else { $response = $view; } return $response; }