Sunday, May 21, 2017

How to use each in Larave as recurse?

I have some objects like as:

array:8 [▼
  "_id" => MongoId {#261 ▶}
  "name" => "Objects"
  "default" => "900"
  "visibility" => "1"
  "type" => "2"
  "only_numbers" => null
  "value" => array:2 [▼
    0 => "59222778470e6c8e0b3c988a"
    1 => "59222880470e6cb90e3c9897"
  ]
  "available" => "1"
]

I try to display this on the page:

 

But inside value exists keys on nested objects with the same structure.

So, I need to display these childrens.

How to do that using each operator in blade Laravel?

I tried:

@each('field.objects', $field, $field["value"])

Where template is:

<div class="fields-list row">
    @foreach($field["value"] as $k => $v)
        <div class="col-md-4"></div>
        <div class="col-md-8">
            
        </div>
    @endforeach
</div>



via Blablacar

Advertisement