How to recreate image upload for my own image uploader.

  • Screenshot 2019-12-12 at 16.52.50.png

    So I made my own addition to the bagisto package. In my package I want to upload images. I've been looking through the files of /Webkul/Admin/src and /Webkul/Product/src and the only thing I see is that you check if the mime type is an image. I don't see where you add these images to the database. So i've added the <image-wrapper> to my own package and i've added 'images' to my request, but I still don't know what to do to save it to the database

  • Hi KevLav,

    Within ProductRepository, uploadImages method has been called of ProductImageRepository which processes the product images to get save in database.


  • @prateek-webkul I've added multiple models and contracts and such now. But i'm getting the error

    Target [Laveto\Aroma\Contracts\BrandImage] is not instantiable while building [Laveto\Aroma\Http\Controllers\BrandController, Laveto\Aroma\Repositories\BrandRepository].

    I'm not quite sure how to fix it. I've been trying to copy it while only keeping the code I need. But i'm not quite getting it

    Screenshot 2019-12-13 at 11.30.33.png

    Here is a small preview of all my files:
    Screenshot 2019-12-13 at 11.31.24.png Screenshot 2019-12-13 at 11.31.29.png Screenshot 2019-12-13 at 11.31.37.png Screenshot 2019-12-13 at 11.31.42.png Screenshot 2019-12-13 at 11.30.48.png Screenshot 2019-12-13 at 11.30.53.png Screenshot 2019-12-13 at 11.30.59.png Screenshot 2019-12-13 at 11.31.04.png Screenshot 2019-12-13 at 11.31.07.png

  • Within AromaServiceProvider, register your package ModuleServiceProvider within boot method by writing below line :


  • @prateek-webkul Oke so I have no errors now, but how does imagerepository uploadimages get called, cause when I use dd() it doesn't show. So something before this step is not quite complete

  • Oke seems like I fixed that. Now the image doesn't show as an UploadedFile object so it doesn't upload but it does get into the uploadImages function now.

  • @KevLav Oke so, the $this->brand->update in BrandController didn't call the function from BrandRepository. After I fixed that I added enctype="multipart/form-data" to my form so I got an uploaded file and then it worked

  • Hi KevLav,

    I didn't get you does your problem gets solved or you have any other query? Can you please explain more..

Log in to reply