PHP code example of itstructure / laravel-multi-menu

1. Go to this page and download the library: Download itstructure/laravel-multi-menu library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

itstructure / laravel-multi-menu example snippets


return [
    'primaryKeyName' => 'id', // Editable
    'parentKeyName' => 'parent_id', // Editable
    'mainTemplate' => 'main', // Editable
    'itemTemplate' => 'item', // Editable
];

@php
$multiOptions = [ // Editable
    'config' => config('multimenu'),
    'data' => $pages
];
@endphp

@multiMenu($multiOptions)

return [
    'primaryKeyName' => 'id',
    'parentKeyName' => 'parent_id',
    'mainTemplate' => 'main',
    'itemTemplate' => [
        'levels' => [
            'item',
            'item',
            'item_new',
        ]
    ],
];

<li>
    <a href="{{ $data->icon }}">
        Initial item Id {{ $data->id }} {{ isset($addition) ? ' | ' . $addition : '' }}
    </a>
</li>

<li>
    <a href="{{ $data->icon }}" style="color: green; font-weight: bold;">
        New item Id {{ $data->id }} {{ isset($addition) ? ' | ' . $addition : '' }}
    </a>
</li>

@php
$multiOptions = [
    'config' => config('multimenu'),
    'data' => $pages,
    'additionData' => [
        'levels' => [
            0 => [],
            1 => ['addition' => 'addition string']
        ]
    ]
];
@endphp

@multiMenu($multiOptions)