Foreach, and the Loop Object

Episode 7 Run Time 5:27

This next addition to Laravel 5.3 is a small, but useful one. When using the foreach or forelse Blade directives, you'll now have a new $loop object available to each iteration. This will provide useful information about the loop, including the current index, if it's the first or last item, if there are remaining iterations for the loop, and more.

Publish Date: August 2, 2016