public function deleteById($id) { $isDeleted = valoracion::where('id', $id)->delete(); return $isDeleted; }
public function getInfo(Request $request, $id) { $servs = new servicios(); $hotel = entidadTuristica::where('rif', $id)->first(); $fotos = $hotel->galeria; $servicios = (array) $hotel->servicios['attributes']; $array_keys = array_keys($servicios); unset($array_keys[12]); $nombreFotos = $servs->nombreFotos(); $nombres = $servs->nombres(); $valoraciones = valoracion::where('identidad', $id)->orderBy('created_at', 'DESC')->get(); $galeria = new galeria(); if ($hotel->imagen != null) { $idFotoPerfil = $galeria->getFotoID($hotel->imagen); } else { $idFotoPerfil = null; } $respuesta = ['hotel' => $hotel, 'fotos' => $fotos, 'servicios' => $servicios, 'array_keys' => $array_keys, 'nombres' => $nombres, 'nombreFotos' => $nombreFotos, 'idFotoPerfil' => $idFotoPerfil, 'valoraciones' => $valoraciones]; $view = View::make('adminSuper.info')->with($respuesta); if ($request->ajax()) { $sections = $view->renderSections(); $response = Response::json(['success' => true, 'data' => $sections['info']], 200); } else { $response = $view; } return $response; }
public function postAceptComent(Request $request) { $val = valoracion::where('id', $request->id)->update(['state' => 'Aceptado']); if ($val) { return $response = Response::json(['success' => true], 200); } else { return $response = Response::json(['success' => false, 'message' => 'Error al modificar la valoración'], 400); } }
public function getListaComentarios(Request $request) { $toMatch = ['identidad' => Session::get("idEnt")]; $dateNow = new Carbon('today'); $dateLastWeek = new Carbon('last week'); $dateLastMonth = new Carbon('last Month'); //Haciendo query segun fecha... if ($request->has('date')) { if ($request->date == 'semana') { $valoraciones = valoracion::where($toMatch)->where("created_at", ">=", $dateLastWeek->toDateTimeString())->where("created_at", "<=", $dateNow->toDateTimeString())->orderBy('created_at', 'DESC')->paginate(4); } elseif ($request->date == 'mes') { $valoraciones = valoracion::where($toMatch)->where("created_at", ">=", $dateLastMonth->toDateTimeString())->where("created_at", "<=", $dateNow->toDateTimeString())->orderBy('created_at', 'DESC')->paginate(4); } else { $valoraciones = valoracion::where($toMatch)->orderBy('created_at', 'DESC')->paginate(4); } } else { $valoraciones = valoracion::where($toMatch)->orderBy('created_at', 'DESC')->paginate(4); } $view = View::make('adminHotel.lista-comentarios')->with(['valoraciones' => $valoraciones]); $sections = $view->renderSections(); $response = Response::json(['success' => true, 'data' => $sections['lista-comentarios']], 200); return $response; }