Reputation: 1165
I have a database with images related to one product, and I'd like to take those images there only from the second one.
The code to my view is this. I put a line for each image
@foreach($allImages as $image)
<a href="" class="item-thumb"> <img src="{{ asset('merchants/images/products/' . $image->image) }}" alt="little picture"></a>
@endforeach
I hope I'm clear enough on what I'd like to do...
Upvotes: 0
Views: 43
Reputation: 788
@foreach($allImages->skip(1) as $image)
<a href="" class="item-thumb"> <img src="{{ asset('merchants/images/products/' . $image->image) }}" alt="little picture"></a>
@endforeach
This will skip the first record
Upvotes: 4
Reputation: 3185
You can do something like this to skip the first image in the array
@foreach($allImages as $image)
@if($loop->first){
@continue;
}
else{
<a href="" class="item-thumb"> <img src="{{ asset('merchants/images/products/' . $image->image) }}" alt="little picture"></a>
}
@endforeach
I hope it is helpful for you
Upvotes: 1