norman-huth / nova-detached-actions

一个Laravel Nova工具,允许将操作放置在Nova工具栏中,与复选框选择机制分离。

安装: 554

依赖者: 0

建议者: 0

安全: 0

星星: 1

关注者: 0

分支: 50

语言:Vue

v1.0.2 2023-12-18 20:14 UTC

This package is auto-updated.

Last update: 2024-09-18 21:57:03 UTC


README

此包可能不再必需。自从Laravel Nova v4.24.0版本以来,现在也有独立操作了。
注册操作:独立操作

这个想法基于Jefferson Simão Gonçalves的jeffersonsimaogoncalves/nova-detached-actions

安装

composer require norman-huth/nova-detached-actions

用法

创建操作并扩展DetachedAction类

php artisan nova:action MyDetachedAction
use NormanHuth\NovaDetachedActions\DetachedAction;

class MyDetachedAction extends DetachedAction

选项

破坏性操作

public function actions(NovaRequest $request): array
{
    return [
        (new MyDetachedAction)->isDestructive()
    ];
}

添加Heroicon图标

public function actions(NovaRequest $request): array
{
    return [
        (new MyDetachedAction)->icon('users')
    ];
}

添加FontAwesome图标

FontAwesome不包括在内!

你可以选择使用php artisan nova-package:font-awesome安装Font Awesome免费版本。

public function actions(NovaRequest $request): array
{
    return [
        (new MyDetachedAction)->faIcon('fa-solid fa-user')
    ];
}

添加SVG图标

public function actions(NovaRequest $request): array
{
    return [
        (new MyDetachedAction)->svgIcon('<svg xmlns="...')
    ];
}

添加图像图标

public function actions(NovaRequest $request): array
{
    return [
        (new MyDetachedAction)->imageIcon(asset('images/users.png'))
    ];
}

添加HTML代码图标

public function actions(NovaRequest $request): array
{
    return [
        (new MyDetachedAction)->htmlIcon('YOUR-HTML-CODE')
    ];
}

为按钮添加类

(new MyDetachedAction)->addButtonClasses(['text-center'])

设置按钮类

(new MyDetachedAction)->setButtonClasses(['text-center'])

使用按钮样式

(new MyDetachedAction)->setButtonStyle('primary')

默认样式是primary。可用的是primarydangersuccesswarning

你可以发布配置文件并更改主题。

php artisan vendor:publish --provider=NormanHuth\NovaDetachedActions\ToolServiceProvider