PHP code example of fidum / laravel-nova-metrics-polling

1. Go to this page and download the library: Download fidum/laravel-nova-metrics-polling library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

fidum / laravel-nova-metrics-polling example snippets




namespace App\Nova\Metrics;

use Fidum\LaravelNovaMetricsPolling\Concerns\SupportsPolling;

class NewUsers extends Value
{
    use SupportsPolling;

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),
    ];
}

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),
    ];
}