2021年4月7日星期三

Laravel8 - View loaded by @include in loop always keeps a value of the first loop

When I do things like this:

<loader.blade.php>  @foreach($items as $item)    @include('loaded', ['item' => $item])  @endforeach  
<loaded.blade.php>  <div>      </div>  

$item in loaded.blade.php always has the same value, meaning the value of the first $item in loop.

Is this normal? If so, how can I avoid it. If that is not normal, what might be causing this problem?

https://stackoverflow.com/questions/66996806/laravel8-view-loaded-by-include-in-loop-always-keeps-a-value-of-the-first-loo April 08, 2021 at 11:05AM

没有评论:

发表评论