PHP code example of tomatophp / filament-menus

1. Go to this page and download the library: Download tomatophp/filament-menus 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/ */

    

tomatophp / filament-menus example snippets


->plugins(
    \Filament\SpatieLaravelTranslatablePlugin::make()->defaultLocales(['en', 'ar'])
    \TomatoPHP\FilamentMenus\FilamentMenusPlugin::make()
)

use Filament\Navigation\NavigationBuilder;
use Filament\Navigation\NavigationGroup;
use TomatoPHP\FilamentMenus\FilamentMenuLoader;

$panel->navigation(function (NavigationBuilder $builder){
    return $builder
        // Use Inside Group
        ->groups([
            NavigationGroup::make()
                ->label('Dashboard')
                ->items(FilamentMenuLoader::make('dashboard')),
        ])
        // Use Directly
        ->items(FilamentMenuLoader::make('dashboard'));
})
bash
php artisan filament-menus:install
blade 
<x-filament-menu menu="header" />
blade
@foreach (menu('header') as $item)
<a class="text-gray-500" href="{{ $item['url'] }}" @if($item['blank']) target="_blank" @endif>
    <span class="flex justify-between">
        @if(isset($item['icon']) && !empty($item['icon']))
        <x-icon class="w-4 h-4 mx-2" name="{{ $item['icon'] }}"></x-icon>
        @endif
        {{ $item['title'] }}
    </span>
</a>
@endforeach
bash
php artisan vendor:publish --tag="filament-menus-config"
bash
php artisan vendor:publish --tag="filament-menus-views"
bash
php artisan vendor:publish --tag="filament-menus-lang"
bash
php artisan vendor:publish --tag="filament-menus-migrations"