How Laravel uses $loop in a two-tier loop
This article will explain in detail how Laravel uses $loop in a two-tier loop. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.
Use $loop in a two-tier loop
In blade's foreach, if you want to get the variables of the outer loop
Foreach ($users as $user) @ foreach ($user- > posts as $post) @ if ($loop- > parent- > first) This is first iteration of the parent loop. @ endif @ endforeach @ endforeach this is the end of the article on "how Laravel uses $loop in a two-tier loop". I hope the above content can be helpful to you so that you can learn more knowledge. if you think the article is good, please share it for more people to see.