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

  laravel, php

When I do things like this:

@foreach($items as $item)
  @include('loaded', ['item' => $item])
  {{ $item->name }}

$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?

Source: Laravel

Leave a Reply