Answer the question
In order to leave comments, you need to log in
Blade in laravel not able to work with recursion?
@if (Form::closureTags($item))
@if(isset($item['closureTag']))
@include('tags-closure.widgets.edit-form', $item['closureTag']))
@endif
@else
@foreach($item as $el)
@include('tags-closure.widgets.edit-form', $el)
@endforeach
@endif
array:8 [▼
"id" => 247
"name" => "saddsd"
"parent_id" => null
"description" => "Adasd"
"weight" => 1.0
"is_sealed" => 0
"closure" => array:4 [▶]
"closureTag" => array:1 [▼
0 => & array:8 [▼
"id" => 248
"name" => "dsadsa"
"parent_id" => 247
"description" => "dsadsd"
"weight" => 1.0
"is_sealed" => 0
"closure" => array:4 [▶]
"closureTag" => array:1 [▼
Answer the question
In order to leave comments, you need to log in
When you include in a scope, you throw the content of the elements, and do not redefine it. Accordingly, it works with the same $item and falls into an endless recursion.
need
@include('tags-closure.widgets.edit-form', ['item' => $item['closureTag']]))
@include('tags-closure.widgets.edit-form', ['item ' => $el])
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question