定制 fidum/laravel-nova-metrics-polling 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

fidum/laravel-nova-metrics-polling

最新稳定版本:1.0.4

Composer 安装命令:

composer require fidum/laravel-nova-metrics-polling

包简介

Easily add polling to all your Laravel Nova metrics and cards!

README 文档

README

Latest Version on Packagist GitHub Workflow Status (with branch) Twitter Follow

Easily add polling to all your Laravel Nova metrics and cards!

Installation

You can install the package via composer:

composer require fidum/laravel-nova-metrics-polling

Usage

Firstly, just add the SupportsPolling trait to any of your Metrics or Card classes:

<?php

namespace App\Nova\Metrics;

use Fidum\LaravelNovaMetricsPolling\Concerns\SupportsPolling;

class NewUsers extends Value
{
    use SupportsPolling;

Then in the Dashboard, Resource or Lens cards method where you have registered your card you can call refreshIntervalSeconds and pass in the number of seconds you want the interval to be between refresh requests. You can also pass a closure as needed.

use App\Nova\Metrics\NewUsers;
use App\Nova\Metrics\NewOrders;

public function cards(NovaRequest $request)
{
    return [
        NewUsers::make()->refreshIntervalSeconds(30),
        NewOrders::make()->refreshIntervalSeconds(fn () => 30),
    ];
}

If preferred, you can call refreshIntervalMilliseconds instead and pass in the number of milliseconds you want the interval to be between refresh requests.

use App\Nova\Metrics\NewUsers;
use App\Nova\Metrics\NewOrders;

public function cards(NovaRequest $request)
{
    return [
        NewUsers::make()->refreshIntervalMilliseconds(30000),
        NewOrders::make()->refreshIntervalMilliseconds(fn () => 30000),
    ];
}

That is it, your cards should now be polling at the specified intervals! 🎉

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 13.76k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 6
  • 点击次数: 0
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 6
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-07-18

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固