Get the App
SLTechnology News&Howtos  ›  Development  › 

How Laravel uses $loop in a two-tier loop

Shulou Source: shulou.com Published: 2022-06-01 04:38:33 09月22日 Update

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.

Tags: Loops articles more good practical content variables outer layers articles knowledge references help related Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia Docker Redmi Huawei Linux