PHP code example of johnpaulmedina / nova-metric-polling

1. Go to this page and download the library: Download johnpaulmedina/nova-metric-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/ */

    

johnpaulmedina / nova-metric-polling example snippets




namespace App\Nova\Metrics;

use Johnpaulmedina\NoveMetricPolling\ValueInterval;




namespace App\Nova\Metrics;

use Laravel\Nova\Http\Requests\NovaRequest;
use Laravel\Nova\Metrics\Value;
use Laravel\Nova\Nova;
use Johnpaulmedina\NovaMetricPolling\ValueInterval;

class ActiveUsers extends Value
{
    use ValueInterval;


    /**
     * Get the cards available for the request.
     *
     * @param  \Laravel\Nova\Http\Requests\NovaRequest  $request
     * @return array
     */
    public function cards(NovaRequest $request)
    {
        return [
            (new Metrics\ActiveUsers())->refreshAtInterval(300), // (IE: 300 seconds / 60 = 5 minutes)
        ];
    }



namespace App\Nova\Metrics;

use Laravel\Nova\Http\Requests\NovaRequest;
use Laravel\Nova\Metrics\Value;
use Laravel\Nova\Nova;
use Johnpaulmedina\NovaMetricPolling\ValueInterval;

class ActiveUsers extends Value
{
    use ValueInterval;

    public $refreshAtInterval = 300; // (IE: 300 seconds / 60 = 5 minutes)