PHP code example of fayne / laravel-filament-menu

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

    

fayne / laravel-filament-menu example snippets


use Fayne\Menu\Filament\MenuPlugin;

return $panel->plugins([
    // Keep the host's existing plugins.
    MenuPlugin::make(),
]);

namespace App\Models;

class Menu extends \Fayne\Menu\Models\Menu
{
}

namespace App\Filament\Resources;

use Fayne\Menu\Filament\Resources\MenuResource as BaseMenuResource;
use Filament\Forms\Components\TextInput;
use Filament\Schemas\Schema;

class MenuResource extends BaseMenuResource
{
    public static function form(Schema $schema): Schema
    {
        $schema = parent::form($schema);

        return $schema->components([
            ...$schema->getComponents(),
            TextInput::make('settings.project_note'),
        ]);
    }
}

// config/filament-menu.php
'models' => [
    'menu' => \App\Models\Menu::class,
],
'resources' => [
    'menu' => \App\Filament\Resources\MenuResource::class,
],
'resource_slugs' => [
    'menu' => 'content-menus',
],

// config/filament-menu.php
'menu_builder' => ['max_depth' => 5],
'use_default_frontend_routes' => true,

// config/filament-cms.php
'multilingual_enabled' => true,
'default_locale' => 'en',
'supported_locales' => ['en' => 'English', 'zh_CN' => '简体中文'],
bash
composer vendor:publish --tag=filament-menu-config
php artisan cms:install
php artisan filament:assets
php artisan cms:menu:install
bash
php artisan cms:menu:install
php artisan cms:menu:install --demo
php artisan cms:menu:install --demo --tenant=shop
php artisan cms:menu:install --no-interaction