%PDF- %PDF-
Direktori : /home/forge/api-takeaseat.eco-n-tech.co.uk/app/Nova/Metrics/ |
Current File : //home/forge/api-takeaseat.eco-n-tech.co.uk/app/Nova/Metrics/AverageBookingValue.php |
<?php namespace App\Nova\Metrics; use Laravel\Nova\Http\Requests\NovaRequest; use Laravel\Nova\Metrics\Value; class AverageBookingValue extends Value { /** * Calculate the value of the metric. * * @param \Laravel\Nova\Http\Requests\NovaRequest $request * @return mixed */ public function calculate(NovaRequest $request) { return $this->average($request, \App\Models\Payment::class, 'amount')->currency('£'); } /** * Get the ranges available for the metric. * * @return array */ public function ranges() { return [ 30 => __('30 Days'), 60 => __('60 Days'), 365 => __('365 Days'), 'TODAY' => __('Today'), 'MTD' => __('Month To Date'), 'QTD' => __('Quarter To Date'), 'YTD' => __('Year To Date'), ]; } /** * Determine for how many minutes the metric should be cached. * * @return \DateTimeInterface|\DateInterval|float|int */ public function cacheFor() { return now()->addMinutes(5); } /** * Get the URI key for the metric. * * @return string */ public function uriKey() { return 'average-booking'; } }