Use the $loop variable in Blade foreach loops to access metadata about the loop
- ·
- Telegram
- ·
- Newsletter
A handy $loop object is available in Laravel Blade foreach loops. Super useful for controlling output based on the loop position ➰
Source dive for reference: https://github.com/laravel/framework/blob/8.x/src/Illuminate/View/Concerns/ManagesLoops.php