Support the ongoing development of →
posted 7 years ago
Last updated 10 months ago.

I would use Laravel's storage class, so in the future if you decide to move to the cloud you can do so .easily.

instead of sending the file on the form post data, upload images with ajax and insert a hidden input with the image id. <input type="hidden" name="image_ids[]" value="1">

Create a new model (image or something) then save each image on the db. so you can easily save images and product relationships in just one line.

class Product{
    public function images()
        return $this->belongsToMany(Image::class);

class Image{
    public function product()
        return $this->belongsToMany(Product::class);

    public function getMediumUrlAttribute()
         // return path to medium size file


 echo $image->medium_url;
Last updated 7 years ago.

Thank you astroanu it's works fine for me, thanks alot.


^_^ good to know


Sign in to participate in this thread!


Your banner here too?

yokeswar yokeswar Joined 9 Oct 2014


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2023 - All rights reserved.