php - How to add an image in laravel cart and show in blade template -


cartcontroller.php

public function addcart(request $req) {     $id = $req->id ;     $name = $req->name;     $quantity = $req->quantity;     $cost = $req->cost;     $image = $req->image;      cart::add(array('id' => $id,                     'name' => $name,                      'qty' => $quantity,                      'price' => $cost,                     'image' => $image));      $cart = cart::content();      return view('viewcart')->with('cart',$cart); } 

viewcart.blade.php

@foreach ($cart $product)      {{ $product->id }}     {{ $product->name }}     {{ $product->qty }}     {{ $product->price }}     {{ $product->image }}  @endforeach 

the following work fine:

{{ $product->id }} {{ $product->name }} {{ $product->qty }} {{ $product->price }} 

however, below not show anything:

{{ $product->image }} 

how solve problem?

to display image have use html img tag eg:

<img src="{{ $product->image }}">

p.s. must store proper path of image in $product->image display it.


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -