承接 novius/laravel-nova-menu 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

novius/laravel-nova-menu

最新稳定版本:8.1.4

Composer 安装命令:

composer require novius/laravel-nova-menu

包简介

A Nova resource tool to manage menus in your application.

README 文档

README

Travis Packagist Release Licence

A Nova tool to manage menus.

Requirements

  • PHP >= 8.2
  • Laravel Nova >= 4.0
  • Laravel Framework >= 10.0

NOTE: These instructions are for Laravel >= 9.0 and Laravel Nova 4.0. If you are using prior version, please see the previous version's docs.

Installation

composer require novius/laravel-nova-menu

Then, launch migrations

php artisan migrate

Configuration

Some options that you can override are available.

php artisan vendor:publish --provider="Novius\LaravelNovaMenu\LaravelNovaMenuServiceProvider" --tag="config"

Edit default templates

Run:

php artisan vendor:publish --provider="Novius\LaravelNovaMenu\LaravelNovaMenuServiceProvider" --tag="views"

Usage

Blade directive

You can display menu with :

<x-laravel-nova-menu::menu menu="slug-of-menu" />

You can also display menu by passing the model instance :

<x-laravel-nova-menu::menu :menu="Menu::find(1)" />

By default a fallback to app()->getLocale() is activated.

If you want force a specific slug with no fallback you can call :

<x-laravel-nova-menu::menu menu="slug-of-menu" :localeFallback="false" />

If you want to use a specific view you can call :

<x-laravel-nova-menu::menu menu="slug-of-menu" view="partial/menu" />

Override views

You can override views with :

php artisan vendor:publish --provider="Novius\LaravelNovaMenu\LaravelNovaMenuServiceProvider" --tag="views"

Manage internal link possibilities

Laravel Nova Menu uses Laravel Linkable to manage linkable routes and models. Please read the documentation.

Customize tree passed to the view

<?php

namespace App\Providers;

use Novius\LaravelNovaMenu\LaravelNovaMenuService;

class AppServiceProvider extends ServiceProvider
{
     // ...
     
    public function boot()
    {
        /**
         * @var LaravelNovaMenuService $menu
         */
        $menu = $this->app->get('laravel-nova-menu');
        $menu->setTreeUsing(function(Menu $menu, array $tree) {
            // ... your actions on tree
            return $tree;
        });
    }
}

Customize tree building

<?php

namespace App\Providers;

use Novius\LaravelNovaMenu\LaravelNovaMenuService;

class AppServiceProvider extends ServiceProvider
{
     // ...
     
    public function boot()
    {
        /**
         * @var LaravelNovaMenuService $menu
         */
        $menu = $this->app->get('laravel-nova-menu');
        $menu->setBuildTreeUsing(function(Collection $items) {
            // ... your actions to build tree as an array
            return $tree;
        });
    }
}

Lint

Run php-cs with:

composer run-script lint

Contributing

Contributions are welcome! Leave an issue on Github, or create a Pull Request.

Licence

This package is under GNU Affero General Public License v3 or (at your option) any later version.

统计信息

  • 总下载量: 16.96k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 9
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 9
  • Watchers: 5
  • Forks: 8
  • 开发语言: PHP

其他信息

  • 授权协议: AGPL-3.0-or-later
  • 更新时间: 2019-09-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固