Exemplo n.º 1
0
 public function getFotoID($nombreFoto)
 {
     $idFoto = galeriaHabitacion::where("nombre", $nombreFoto)->first();
     if ($idFoto != null) {
         return $idFoto->id;
     } else {
         return null;
     }
 }
Exemplo n.º 2
0
 public function getFotos($id)
 {
     $fotos = galeriaHabitacion::where('idhabitacion', $id)->get();
     return $fotos;
 }
Exemplo n.º 3
0
 public function deleteFile(Request $request)
 {
     if ($request->has("fotos")) {
         foreach ($request->fotos as $foto) {
             if ($request->has("habitacion")) {
                 $fotoDelete = galeriaHabitacion::where("id", $foto)->first();
             } else {
                 $fotoDelete = galeria::where("id", $foto)->first();
             }
             $rutaFoto = public_path() . "/imagesUploaded" . "/" . $fotoDelete->nombre;
             File::delete($rutaFoto);
             $fotoDelete->delete();
         }
         if ($request->deleteImagePerfil == true) {
             if ($request->has("habitacion")) {
                 $habit = habitacion::where('id', $request->habitacion)->update(['imagen' => null]);
             } else {
                 $entidadTuristica = entidadTuristica::where('rif', Session::get("idEnt"))->update(['imagen' => null]);
             }
         }
         //dd($count);
         $response = Response::json(["message" => "Imagenes eliminadas con exito."], 200);
         return $response;
     } else {
         return Response::json(["message" => "Error al eliminar las imagenes"], 400);
     }
 }