kirschbaum-development/nova-inline-select
Composer 安装命令:
composer require kirschbaum-development/nova-inline-select
包简介
An inline select field for Laravel Nova apps.
README 文档
README
This package has been forked from kirschbaum-development/nova-inline-select and updated to support Laravel Nova v5.
An inline select field for Nova apps
This package contains a Nova select field that can update field values inline from the index and detail views.
Requirements
| Nova Version | Inline Select Version |
|---|---|
| v1-3 | ^1.0 |
| v4 | ^2.0 |
This Nova field requires Nova 1.0 or higher.
Installation
You can install this package in a Laravel app that uses Nova via composer:
First, add this to the repositories section of your composer.json file:
"repositories": [
{
"type": "git",
"url": "https://github.com/MaidenVoyageSoftware/nova-inline-select.git"
},
]
Then, install the package as usual
composer require kirschbaum-development/nova-inline-select
Usage
Next you can use the KirschbaumDevelopment\Nova\InlineSelect field in your Nova resource:
namespace App\Nova; use KirschbaumDevelopment\Nova\InlineSelect; class User extends Resource { // ... public function fields(Request $request) { return [ // ... InlineSelect::make('Status'), // ... ]; } }
Use the InlineSelect field just like Nova's Select field. But now for the magic...
Inline editing
By default, the inline select field works just like a normal select field. To enable the inline editing capabilities we can use the inlineOnIndex() and inlineOnDetail() methods.
InlineSelect::make('Status')->options($options) ->inlineOnIndex() ->inlineOnDetail(),
The above inline select field will show up on both the index and detail views. When making a change to the select field, a button will display next to the field allowing you to commit the change. If you would rather the field auto-submits the change, simply add enableOneStepOnIndex() or enableOneStepOnDetail().
InlineSelect::make('Status')->options($options) ->inlineOnIndex() ->enableOneStepOnIndex(),
The inline select field on the index view now will auto-submit the changed value. You can also continue to use the old disableTwoStepOnIndex() method if you choose, which just calls enableOneStepOnIndex() under the hood.
You can also add the inline select to Lenses. Use the inlineOnLens() method. Auto-submitting works the same as well with enableOneStepOnLens().
InlineSelect::make('Status')->options($options) ->inlineOnLens() ->enableOneStepOnLens(),
Display using labels
This method works just like Nova's select field. It will display the option value rather than the option key.
InlineSelect::make('Status')->options($options) ->displayUsingLabels(),
Using closures as options() argument
You may pass a closure to the options method. It must return a key value pair array.
InlineSelect::make('Status') ->options(function () { return [ 'one' => 'foo', 'two' => 'bar', ]; }),
Validation caveats
In the case where fields on a model are required, which is likely, an extra step needs to be taken to ensure the inline select update persists and doesn't throw an error. The validation rule sometimes needs to be added to the updateRules() method on any field that is required.
Text::make('Email') ->rules('required', 'email') ->updateRules('sometimes'),
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email brandon@kirschbaumdevelopment.com or nathan@kirschbaumdevelopment.com instead of using the issue tracker.
Credits
Sponsorship
Development of this package is sponsored by Kirschbaum Development Group, a developer driven company focused on problem solving, team building, and community. Learn more about us or join us!
License
The MIT License (MIT). Please see License File for more information.
kirschbaum-development/nova-inline-select 适用场景与选型建议
kirschbaum-development/nova-inline-select 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 546.59k 次下载、GitHub Stars 达 93, 最近一次更新时间为 2019 年 04 月 05 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「nova」 「laravel」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 kirschbaum-development/nova-inline-select 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 kirschbaum-development/nova-inline-select 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 kirschbaum-development/nova-inline-select 相关的其它包
同方向 / 同关键字的高下载量 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.
统计信息
- 总下载量: 546.59k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 95
- 点击次数: 22
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-04-05


