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