devtropolis / nova-simple-status-card
Laravel Nova卡片。
0.2
2018-09-21 10:22 UTC
Requires
- php: >=7.1.0
This package is auto-updated.
Last update: 2024-09-22 00:30:59 UTC
README
一个非常简单的Laravel Nova状态卡片。配置一个返回状态和消息的端点即可使用。
安装卡片
您可以通过以下命令使用Composer安装卡片
composer require devtropolis/nova-simple-status-card
卡片需要一个URL传入,卡片包中包含一个测试URL,您也可以指定任何您想要的URL
然后您需要在cards数组中注册卡片
public function cards()
{
return [
new NovaSimpleStatusCard->options(['/nova-vendor/statuscard/statusTestEndpoint']),
];
}
卡片选项
您可以自定义以下选项
- 获取间隔 - 以毫秒为单位,URL被轮询的频率
- 卡片标题 - 显示在顶部标题
- 图标 - 显示在卡片右上角的图标
要设置选项,只需将它们作为数组元素传递给卡片的options方法
(new NovaSimpleStatusCard())->options(['title' => 'My Custom Title',
'url' => '/nova-vendor/statuscard/statusTestEndpoint',
'icon' => 'https://avatars3.githubusercontent.com/u/2988541?s=200&v=4'
'fetchInterval' => 5000
]),
端点响应格式
为了使卡片显示内容,您需要配置您的端点以响应以下对象
return response([
'status'=> 'YOUR_RESPONSE_STATUS one of pass,fail,other',
'message'=> 'Any message you want displaying in the footer'
]);