Bagisto Forum

    Bagisto

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups

    How to recreate image upload for my own image uploader.

    Modules
    image upload backend
    2
    8
    1969
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • K
      KevLav last edited by

      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

      1 Reply Last reply Reply Quote 0
      • P
        prateek-webkul last edited by

        Hi KevLav,

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

        Thanks

        K 1 Reply Last reply Reply Quote 0
        • K
          KevLav @prateek-webkul last edited by KevLav

          @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

          1 Reply Last reply Reply Quote 0
          • P
            prateek-webkul last edited by

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

            $this->app->register(ModuleServiceProvider::class);
            
            K 1 Reply Last reply Reply Quote 1
            • K
              KevLav @prateek-webkul last edited by

              @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

              K 1 Reply Last reply Reply Quote 0
              • K
                KevLav @KevLav last edited by

                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.

                K 1 Reply Last reply Reply Quote 0
                • K
                  KevLav @KevLav last edited by

                  @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

                  1 Reply Last reply Reply Quote 0
                  • P
                    prateek-webkul last edited by

                    Hi KevLav,

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

                    1 Reply Last reply Reply Quote 0
                    • First post
                      Last post