I am trying to pass an associative array containing an array of associative arrays to the a partial in laravel 5.2:
@include('admin.partials.context-menu', [
'items' => [
['test' => 'test']
],
'icon' => 'more_vert'
])
and trying to access the array items inside the array:
<ul class="context-menu">
@foreach($items as $item)
<li class="context-menu-item">
</li>
@endforeach
</ul>
However, I get an error illegal string offset 'test', as I try to do it.
Things that I have tried so far: Using indexed array 'items' - works, but very unintuitive to develop with Passing object instead of associative array - unexpected behaviour, says it is an object when typeOf, but when accessing a value, says it is not an object.
I can var_dump things in the partial and all the values are as expected, but the problem only arises when I try to access their values via blade as in
Thank you for your help :)
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2kWyMg8
via IFTTT
Aucun commentaire:
Enregistrer un commentaire