承接 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.

统计信息

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

GitHub 信息

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

其他信息

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