samedi 11 janvier 2020

Trying to access array offset on value of type int in Laravel 6.5.2

In my app.blade.php I used to show a menu from an array :

           @if ($menu)
                @foreach ($menu as $submenu)
                <ul class="navbar-nav default">
                    <li class="sub-menu">
                        <a href=""></a>
                        @if ($submenu['child'])
                        <ul>
                            @foreach ($submenu['child'] as $menu)
                            <li class="sub-menu">
                                <a href=""></a>
                            </li>
                        </ul>
                        @endforeach
                        @endif
                    </li>
                </ul>
                @endforeach
            @endif

And I have this array and I worked with it in Controller without any error or problem, but when I use above code in my blade view it return me this error :

Facade\Ignition\Exceptions\ViewException Trying to access array offset on value of type int (View: /var/www/new shop partineh/shop/resources/views/layouts/app.blade.php) Illuminate\Foundation\Bootstrap\HandleExceptions::handleError :60 resources/views/layouts/app.blade.php:60

How can I resolve this error?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire