pdmfc/nova-action-button
Composer 安装命令:
composer require pdmfc/nova-action-button
包简介
A Laravel Nova field to run actions.
README 文档
README
This package allows you to execute an action directly on your resource table view.
Installation
composer require pdmfc/nova-action-button
Usage
use App\Nova\Actions\ChangeRole; use Pdmfc\NovaFields\ActionButton; //... public function fields() { return [ ActionButton::make('Action') ->action(ChangeRole::class, $this->id) //->action(new ChangeRole(), $this->id) using a new instance ]; }
The action() method requires two params - the action class name or a new instance, and the target resource id.
Disabling button
You can use the native Laravel nova readonly() method to prevent users from clicking the button:
ActionButton::make('Action') ->action(ChangeRole::class, $this->id) ->readonly(function () { return $this->role->name === 'admin'; })
Change the button text
To edit the button text content, use the text() method.
->text('Execute')
Enable the loading animation on button and change color
To enable the loading animation on button and change color, use showLoadingAnimation() and loadingColor('#fff') method.
->showLoadingAnimation() ->loadingColor('#fff') # default is #000
Add a svg to the button
In order to add a svg to the button, you first need to create a vue component containing a svg and then pass the component name to the svg() method.
->svg('VueComponentName')
Change button color
To change button color, use buttonColor('#21b970') method.
->buttonColor('#21b970') # default is .btn-primary color
Caveats
- Currently, in order to use this field, you still have to declare the action in your resource
actions()method.
How to contribute
- clone the repo
- on
composer.jsonof a laravel nova application add the following:
{
//...
"require" {
"pdmfc/nova-action-button: "*"
},
//...
"repositories": [
{
"type": "path",
"url": "../path_to_your_package_folder"
}
],
}
- run
composer update pdmfc/nova-action-button
You're now ready to start contributing!
Changelog
Please see CHANGELOG for more information on what has changed recently.
pdmfc/nova-action-button 适用场景与选型建议
pdmfc/nova-action-button 是一款 基于 Vue 开发的 Composer 扩展包,目前已累计 755.33k 次下载、GitHub Stars 达 36, 最近一次更新时间为 2020 年 04 月 06 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「nova」 「laravel」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 pdmfc/nova-action-button 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 pdmfc/nova-action-button 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 pdmfc/nova-action-button 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A Laravel Nova card that shows you your system information.
A Laravel Nova card.
A Laravel Nova package for publishable fields
A Laravel Nova package for translatable fields
A Laravel Nova Image field. you can paste or drag or chose an image
A Laravel Nova Mail testing tool.
统计信息
- 总下载量: 755.33k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 37
- 点击次数: 20
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-04-06

