lundi 1 juillet 2019

How to display images from storage folder laravel

I'am trying to retrieve images from storage to the view but it doesn't show the image, in console I see this error Failed to load resource: the server responded with a status of 404 (Not Found). I have tried many solutions including this -> Retrieving image stored in storage folder but still not working.

Code

Controller

 public function store(Request $request) 
{ 

    $product = Product::create($request->all());
    foreach ($request->photos as $photo) {
        $filename = $photo->store('photos');
        ProductsPhoto::create([
            'product_id' => $product->id,
            'filename' => $filename
        ]);
    }

}

blade

 @foreach($products as $product)
 <img src=""
 @endforeach

Any help will be appreciated.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire