1
0
Fork 0
mirror of https://github.com/archtechx/laravel-tips.git synced 2025-12-12 13:24:03 +00:00
laravel-tips/content/tips/use-the-loop-variable-in-blade-foreach-loops-to-access-metadata-about-the-loop.md
2021-11-19 16:10:01 +01:00

633 B

title tweet_id thread_slug author_username images created_at slug
Use the $loop variable in Blade foreach loops to access metadata about the loop 1461703837916405761 weekly-thread-2021-46 alexjgarrett
https://pbs.twimg.com/media/FEemqXrXIAgeMTB.jpg
2021-11-19T14:32:06+00:00 use-the-loop-variable-in-blade-foreach-loops-to-access-metadata-about-the-loop

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