I am trying to fill my webpage with content based on content stored in a database. However, I would like to skip the first item; I want to start looping from the second item.
How can I achieve this?
@foreach($aboutcontent as $about) <div class="col-md-4 text-center"> <div class="thumbnail"> <img id="" class="img-responsive" src="images/{{ $about->aboutimg }}" alt=""> <div class="caption"> <h3>{{ $about->aboutname }}</h3> <p>{{ $about->aboutinfo }}</p> </div> </div> </div> @endforeach
Advertisement
Answer
Try This :
@foreach($aboutcontent as $key => $about) @if($key > 0){ <div class="col-md-4 text-center"> <div class="thumbnail"> <img id="" class="img-responsive" src="images/{{ $about->aboutimg }}" alt=""> <div class="caption"> <h3>{{ $about->aboutname }}</h3> <p>{{ $about->aboutinfo }}</p> </div> </div> </div> @endif; @endforeach