jorgv/nova-plus-button
最新稳定版本:0.6.4
Composer 安装命令:
composer require jorgv/nova-plus-button
包简介
A Laravel Nova field.
README 文档
README
This package contains a Nova field to add increment button to the index view. This is my first Nova package if you have any suggestion or improvement please let me know, I am certeain there can be better approaches.
This field was made in order to add votes and other numeric values from the index view in a quick way
Requirements
This field requires an increment method within your controller and a route like this: /api/resour-name/increment/{id}.
Installation
Install this package in your Laravel app via composer:
composer require jorgv/nova-plus-button
Usage
You can use this field in your forms as default number input and in your index view as a button. You can pass the increaseValue as parameter, by default increases by 1.
\\ use Jorgv\PlusButton\PlusButton; public function fields() { return [ PlusButton::make('count')->increaseValue(5), ]; }
Suggested Method in controller
class YourController extends Controller { public function increment(Request $request, $id) { if (request()->expectsJson()) { $object = Class::find($id); $object->count = $request->count; $object->save(); return $object; } } }
Suggested Route
Route::post('class/increase/{id}', 'YourController@increment');
Credits
License
The MIT License (MIT).
统计信息
- 总下载量: 660
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 6
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-08-28