aiman / nova-menu-builder
Laravel Nova 高级菜单构建工具。
Requires
- php: >=7.1.0
- spatie/laravel-translatable: >=3.1
- dev-master
- v1.0.0
- dev-dependabot/npm_and_yarn/eventsource-and-laravel-mix--removed
- dev-dependabot/npm_and_yarn/json5-and-laravel-mix-2.2.3
- dev-dependabot/npm_and_yarn/async-2.6.4
- dev-dependabot/npm_and_yarn/minimist-and-mkdirp-1.2.8
- dev-dependabot/npm_and_yarn/loader-utils-1.4.2
- dev-dependabot/npm_and_yarn/decode-uri-component-0.2.2
- dev-dependabot/npm_and_yarn/minimatch-3.0.8
- dev-dependabot/npm_and_yarn/node-sass-7.0.0
This package is auto-updated.
Last update: 2023-10-10 04:46:04 UTC
README
此软件包是从 Nova Menu Builder 分支出来的。此软件包支持通过 JTK 使用 thaana 键盘。
此软件包使用 Spatie Translatable
此工具允许您以类似 wordpress 菜单布局的方式在 Laravel Nova 中创建菜单,并支持 thaana 键盘。
安装
您可以通过 composer 在使用 Nova 的 Laravel 应用程序中安装此软件包
composer require aiman/nova-menu-builder
然后您应该发布服务提供者,迁移数据库
php artisan vendor:publish --provider="Aiman\MenuBuilder\ToolServiceProvider"
php artisan migrate
然后运行位于数据库文件夹内部 seeds 文件夹中的 LangaugesTableSeeder
public function run() { $this->call(LanguagesTableSeeder::class); }
执行此命令以运行种子
php artisan db:seed
使用
接下来,您必须使用 Nova 注册此工具。这通常在 NovaServiceProvider 的 tools 方法中完成。
// in app/Providers/NovaServiceProvider.php // ... public function tools() { return [ // ... new \Aiman\MenuBuilder\MenuBuilder(), ]; }
助手
为您的 blade 提供了两个内置助手
-
menu_builder('slug').
为给定的 slug 创建一个 html 菜单。不需要额外的选项。默认情况下,标签是
ul
和li
,没有 html 类。
{!! menu_builder('main') !!} //or {!! menu_builder('main', 'parent-class', 'child-class',with children(boolean) , with active/deactive(boolean), 'dl', 'dd') !!} booleans default is true
-
menu_json('slug').
返回一个包含给定 slug 所有项目的 json。
{!! menu_json('main') !!}
-
menu_type('type').
返回一个包含给定类型所有项目的 json。
参数 main_menu secondary_menu vertical_menu currency_menu langauge_menu
{!! menu_type('main_menu') !!}
本地化
在 /resources/lang/vendor/nova 中找到相应的 xx.json 文件中设置您的翻译。
"Menu Builder": "Menu Builder", "Menu Items": "Menu Items", "Add item": "Add item", "Delete item": "Delete item", "Are you sure to delete this menu item?": "Are you sure to delete this menu item?", "Take care. All children items will be deleted cause you're deleting the parent.": "Take care. All children items will be deleted cause you're deleting the parent.", "Cancel": "Cancel", "Yes, remove!": "Yes, remove!", "Add Menu item": "Add Menu item", "Name": "Name", "Slug": "Slug", "Menu Helper": "Menu Helper", "Link type": "Link type", "Choose an option": "Choose an option", "Static Url": "Static Url", "Dynamic Route": "Dynamic Route", "URL": "URL", "Route": "Route", "Parameters": "Parameters", "Open in": "Open in", "Same window": "Same window", "New window": "New window", "Classes": "Classes", "Create menu item": "Create menu item", "Update menu item": "Update menu item", "Item removed successfully!": "Item removed successfully!", "Item created!": "Item created!", "Item updated!": "Item updated!", "Menu reordered!": "Menu reordered!", "Error on server!": "Error on server!", "Enabled": "Enabled", "Disabled": "Disabled"
重要
该软件包已在 Nova v2.0+ 上进行了测试。最新测试版本为 nova v3.6.0
致谢
向 @Jawish Hameed 致以巨大的敬意,他的 thaana 翻译插件 Thaana Keyboard