php - Taking values from a certain number Laravel

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...
Answer
Solution:
@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
Answer
Solution:
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
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: attempt to read property "id" on null
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.