stafe-group-ab/filament-bookmarks-menu

此插件允许您为 Filament Admin 中的用户添加全局书签菜单

v1.0.8 2023-06-03 22:51 UTC

This package is auto-updated.

Last update: 2024-09-04 01:25:52 UTC


README

Latest Version on Packagist Total Downloads

Screen shot of Filament Bookmarks Menu

Screen shot of Filament User Menu

此 Filament 插件将为您的 Filament Admin 应用程序添加书签菜单。您可以在该菜单中设置全局项目或让用户添加自己的项目。插件将在您希望显示的页面上渲染添加 & 删除书签的图标。

安装

您可以通过 composer 安装此包

composer require stafe-group-ab/filament-bookmarks-menu

您可以使用以下命令发布并运行迁移

php artisan vendor:publish --tag="filament-bookmarks-menu-migrations"
php artisan migrate

您可以使用以下命令发布配置文件

php artisan vendor:publish --tag="filament-bookmarks-menu-config"

这是已发布的配置文件内容,在此您可以轻松地更改图标、颜色等。

return [
    'bookmark_icon' => 'heroicon-o-bookmark',
    'bookmark_class' => 'w-5 h-5 cursor-pointer text-gray-700 dark:text-gray-200',
    'add_bookmark_icon' => 'heroicon-o-bookmark',
    'remove_bookmark_icon' => 'heroicon-s-bookmark',
    'add_bookmark_class' => 'w-6 h-6 cursor-pointer text-danger-700 dark:text-gray-200',
    'remove_bookmark_class' => 'w-6 h-6 cursor-pointer text-danger-700 dark:text-gray-200',
    'add_bookmarks_by_users' => true,
    'exclude_pages' => ['admin', 'bookmarks-menus'],
    'notification_add_icon' => 'heroicon-o-bookmark',
    'notification_remove_icon' => 'heroicon-o-bookmark',
    'notification_add_color' => 'success',
    'notification_remove_color' => 'danger',
    'show_resource_in_navigation' => false,
    'delete_icon' => 'heroicon-o-trash',
    'delete_class' => 'w-5 h-5 cursor-pointer text-danger-700 dark:text-gray-200',
    'delete_text_class' => 'cursor-pointer text-white bg-black dark:text-gray-200',
    'show_private_label_in_menu' => false,
    'show_global_label_in_menu' => false,
];

可选,您可以使用以下命令发布视图

php artisan vendor:publish --tag="filament-bookmarks-menu-views"

可选,您可以使用以下命令发布翻译文件,我们只会提供英文版本

php artisan vendor:publish --tag="filament-bookmarks-menu-translations"

用法

要为登录用户提供将收藏添加到个人书签菜单的能力,请确保您转到配置文件并设置以下内容。这将使插件在所有页面上渲染添加 / 删除书签的图标功能。

 'add_bookmarks_by_users' => true,

删除菜单中的项目

现在您的用户将在所有私人菜单项旁边看到一个 svg 垃圾桶图标。您可以在配置文件中配置此图标和颜色。您还可以在更新的语言文件中设置标签。

    'delete_icon' => 'heroicon-o-trash',
    'delete_class' => 'w-5 h-5 cursor-pointer text-danger-700 dark:text-gray-200',
    'delete_text_class' => 'cursor-pointer text-white bg-black dark:text-gray-200',

在书签菜单中显示标签?

现在您可以在配置文件中启用/禁用书签菜单中的全局 & 私有标签。

   'show_private_label_in_menu' => false,
    'show_global_label_in_menu' => false,

排除页面

在几乎所有情况下,都有些页面您希望排除在此插件之外。配置文件中有一个数组,您可以在其中添加您想要排除的排除项。它将在 Filament Admin 中所有 URL 的末尾字符串中排除。因此,如果您排除编辑以下页面,则插件中将不可用。

'exclude_pages' => ['admin', 'bookmarks-menus'],

测试

composer test

变更日志

请参阅 变更日志 获取有关最近更改的更多信息。

贡献

请参阅 贡献指南 了解详情。

安全漏洞

请参阅 我们的安全策略 了解如何报告安全漏洞。

鸣谢

许可协议

MIT 许可协议 (MIT)。请参阅 许可文件 获取更多信息。