Coder Social home page Coder Social logo

tomatophp / filament-menus Goto Github PK

View Code? Open in Web Editor NEW
5.0 3.0 0.0 1.6 MB

Menu Database builder to use it as a navigation on Filament Panel or as a Livewire Component

Home Page: https://filamentphp.com/plugins/3x1io-tomato-menus

License: MIT License

PHP 91.56% Blade 8.44%
blade component database-menus filamentphp filamentphp-plugin menu-manager menus

filament-menus's Introduction

Screenshot

Filament Menus

Latest Stable Version PHP Version Require License Downloads

Menu Database builder to use it as a navigation on Filament Panel or as a Livewire Component

Screenshots

Menus List Edit Menu Menu Items

Installation

composer require tomatophp/filament-menus

after install your package please run this command

php artisan filament-menus:install

finally register the plugin on /app/Providers/Filament/AdminPanelProvider.php

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

Use as Filament Navigation

you can use this package as a navigation on Filament Admin Panel

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'));
})

where dashboard is a key of menu.

Use as a Livewire Component

go to route admin/menus and create a new menu and you will get the code of livewire component

you can build a menu just by using this command as a livewire component

<x-filament-menu menu="header" />

where header is a key of menu and you will get the code ready on the Table list of menus

you can use custom view ex:

<x-filament-menu menu="header" view="menu-item" />

by default we use Tailwind as a main view with this code

@foreach ($menuItems 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

or you can use direct helper menu($key) to get the menu items

@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

Publish Assets

you can publish config file by use this command

php artisan vendor:publish --tag="filament-menus-config"

you can publish views file by use this command

php artisan vendor:publish --tag="filament-menus-views"

you can publish languages file by use this command

php artisan vendor:publish --tag="filament-menus-lang"

you can publish migrations file by use this command

php artisan vendor:publish --tag="filament-menus-migrations"

Other Filament Packages

Support

you can join our discord server to get support TomatoPHP

Docs

you can check docs of this package on Docs

Changelog

Please see CHANGELOG for more information on what has changed recently.

Security

Please see SECURITY for more information about security.

Credits

License

The MIT License (MIT). Please see License File for more information.

filament-menus's People

Contributors

3x1io avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

filament-menus's Issues

How to render the generated menu?

Hi thanks for the awesome plugin very nice frontend interface but I am stuck and don't know where and how to register the generate code
please provide detailed instructions thanks

Open in new tab doesn't work

Hi,
when creating / editing menu items the option
Open in new tab doesn't work as expected looking at the code I just had to update
database field name "new_tab" instead of "blank" this saves the value in database

/vendor/tomatophp/filament-menus/src/Resources/MenuResource/Relations/MenuItems.php
Forms\Components\Toggle::make('new_tab')

but still doesn't open the link in new tab. please provide a fix thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.