I'm quite new to PHP Blade/Laravel and I'm trying to display an array, which is inside an variable, as HTML.
So I got an variable named $products
and first of all I did this:
This gave me:
Array
(
[0] => Array
(
[title] => Belt
[image] => img/products/belt.jpg
[price] => 79.00
[specialPrice] =>
)
[1] => Array
(
[title] => Hat
[image] => img/products/hat.jpg
[price] => 89.00
[specialPrice] => 69.00
)
[2] => Array
(
[title] => Bag
[image] => img/products/bag.jpg
[price] => 99.00
[specialPrice] => 59.00
)
[3] => Array
(
[title] => Scarf
[image] => img/products/scarf.jpg
[price] => 119.00
[specialPrice] =>
)
)
1
So, I want to display this Array as HTML. I tried this:
@foreach($products as $key => $item)
<p></p>
@endforeach
But that didnt work. What am I doing wrong?
via Steve