Laravel Blade allows to use a helpful set of variable like
When looping, a $loop
variable will be available inside of your loop. This variable provides access to some useful bits of information such as the current loop index and whether this is the first or last iteration through the loop:
@foreach($news as $new)
@if($loop->index < 2)
//div with big image class
@else
//div with small image class
@endif
@endforeach
1
solved Query data in database to show posts