Files
MyX/app/Nova/Metrics/NewConcours.php

55 lines
1.2 KiB
PHP

<?php
namespace App\Nova\Metrics;
use App\Models\Concour;
use Laravel\Nova\Http\Requests\NovaRequest;
use Laravel\Nova\Metrics\Value;
class NewConcours extends Value
{
/**
* Calculate the value of the metric.
*
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
* @return mixed
*/
public function calculate(NovaRequest $request)
{
return $this->count($request, Concour::class);
}
/**
* Get the ranges available for the metric.
*
* @return array
*/
public function ranges()
{
return [
'TODAY' => __('Aujourd\'hui'),
30 => __('30 Jours'),
60 => __('60 Jours'),
365 => __('365 Jours'),
'MTD' => __('Mois à date'),
'QTD' => __('Trimestre à date'),
'YTD' => __('Année à date'),
];
}
/**
* Determine the amount of time the results of the metric should be cached.
*
* @return \DateTimeInterface|\DateInterval|float|int|null
*/
public function cacheFor()
{
// return now()->addMinutes(5);
}
public function name()
{
return 'Concours Participés';
}
}