async store({ params, request }) {
    const property = await Property.findOrFail(params.id);

    const images = request.file("image", {
      types: ["image"],
      size: "2mb"
    });

    await images.moveAll(Helpers.tmpPath("uploads"), file => ({
      name: `${Date.now()}-${file.clientName}`
    }));

    if (!images.movedAll()) {
      return images.errors();
    }

    await Promise.all(
      images
        .movedList()
        .map(image => property.images().create({ path: image.fileName }))
    );
  }
/**
   * Create/save a new image.
   * POST images
   */
Create/save a new image.
POST images
Create / save a new image . POST images
async store({ params, request }) {
    const property = await Property.findOrFail(params.id);
    const images = request.file("image", {
      types: ["image"],
      size: "2mb"
    });
    await images.moveAll(Helpers.tmpPath("uploads"), file => ({
      name: `${Date.now()}-${file.clientName}`
    }));
    if (!images.movedAll()) {
      return images.errors();
    }
    await Promise.all(
      images
        .movedList()
        .map(image => property.images().create({ path: image.fileName }))
    );
  }
async store ( { params , request } ) { const property = await Property . findOrFail ( params . id ) ; const images = request . file ( "image" , { types : [ "image" ] , size : "2mb" } ) ; await images . moveAll ( Helpers . tmpPath ( "uploads" ) , file => ( { name : ` ${ Date . now ( ) } ${ file . clientName } ` } ) ) ; if ( ! images . movedAll ( ) ) { return images . errors ( ) ; } await Promise . all ( images . movedList ( ) . map ( image => property . images ( ) . create ( { path : image . fileName } ) ) ) ; }
Create/save a new image.
Create / save a new image .