demency / pulse-field
一个用于趋势索引的 Laravel Nova 字段。
该包的官方仓库似乎已消失,因此该包已被冻结。
1.3.0
2020-06-29 16:37 UTC
Requires
- php: ^7.3
- laravel/nova: ^2.0|^3.0
This package is auto-updated.
Last update: 2020-09-30 14:38:52 UTC
README
该字段允许您将趋势度量添加到资源索引和详细信息中。
示例
要求
此包需要
- PHP ^7.3。
- Laravel Nova ^2.6.1。
安装
您可以通过 composer 在使用 Nova 的 Laravel 应用中安装此包
composer require demency/pulse-field
用法
在您的资源实现中添加以下代码
<?php ... class YourResource extends Resource { ... public function fields(NovaRequest $request) { // Replace this variable with your own trend. $trend = (new YourOwnTrendClass()); return [ ... // Are you ready? // -------------- // 1. Add field implementation. // 2. Set trend instance as meta. // 3. Use first range or specify directly the range. // 4. Add title for pulse unit, default is "Times" Pulse::make(__('Pulse'), 'id') ->withMeta([ "trend" => $trend, "range" => array_key_first($trend->ranges()), "title" => __("Executions") ]), ]; }
翻译
以下字符串可供翻译
| 字符串 | 描述 |
|---|---|
| 次数 | 如果您没有设置标题元数据,则将回退使用“次数”字符串作为脉冲单位。 |
| 等待数据 | 如果趋势计算返回包含零值的列表,则组件将使用“等待数据”文本渲染。 |
示例 JSON
// Add this line on your own i18n file...
// in my case /resources/lang/vendor/nova/es.json
{
"Waiting for data": "Esperando información",
"Times": "Veces"
}
待办事项
- 添加详细信息视图实现。
变更日志
1.1.0
- 现在此包支持详细信息视图。
1.0.0
- 最近发布,目前此包只能用于索引目的。
免责声明
此包未经测试。请随意提出改进的 PR。
