fixing bugs
This commit is contained in:
33
app/Nova/Metrics/ScreeningsTrend.php
Normal file
33
app/Nova/Metrics/ScreeningsTrend.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Nova\Metrics;
|
||||
|
||||
use App\Models\Screening;
|
||||
use Laravel\Nova\Http\Requests\NovaRequest;
|
||||
use Laravel\Nova\Metrics\Trend;
|
||||
|
||||
final class ScreeningsTrend extends Trend
|
||||
{
|
||||
public ?int $cacheFor = null;
|
||||
|
||||
public function calculate(NovaRequest $request): mixed
|
||||
{
|
||||
return $this->countByDays($request, Screening::class);
|
||||
}
|
||||
|
||||
public function name(): string
|
||||
{
|
||||
return 'Screenings';
|
||||
}
|
||||
|
||||
public function ranges(): array
|
||||
{
|
||||
return [
|
||||
30 => '30 Days',
|
||||
60 => '60 Days',
|
||||
90 => '90 Days',
|
||||
];
|
||||
}
|
||||
}
|
||||
33
app/Nova/Metrics/SessionsTrend.php
Normal file
33
app/Nova/Metrics/SessionsTrend.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Nova\Metrics;
|
||||
|
||||
use App\Models\Session;
|
||||
use Laravel\Nova\Http\Requests\NovaRequest;
|
||||
use Laravel\Nova\Metrics\Trend;
|
||||
|
||||
final class SessionsTrend extends Trend
|
||||
{
|
||||
public function calculate(NovaRequest $request): mixed
|
||||
{
|
||||
return $this->countByDays($request, Session::class);
|
||||
}
|
||||
|
||||
public function name(): string
|
||||
{
|
||||
return 'Sessions';
|
||||
}
|
||||
|
||||
public function ranges(): array
|
||||
{
|
||||
return [
|
||||
30 => '30 Days',
|
||||
60 => '60 Days',
|
||||
90 => '90 Days',
|
||||
];
|
||||
}
|
||||
|
||||
public $cacheFor = null;
|
||||
}
|
||||
47
app/Nova/Metrics/TotalScreenings.php
Normal file
47
app/Nova/Metrics/TotalScreenings.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Nova\Metrics;
|
||||
|
||||
use App\Models\Screening;
|
||||
use Laravel\Nova\Http\Requests\NovaRequest;
|
||||
use Laravel\Nova\Metrics\Value;
|
||||
|
||||
final class TotalScreenings extends Value
|
||||
{
|
||||
/**
|
||||
* Calculate the value of the metric.
|
||||
*/
|
||||
public function calculate(NovaRequest $request): mixed
|
||||
{
|
||||
return $this->count($request, Screening::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the displayable name of the metric.
|
||||
*/
|
||||
public function name(): string
|
||||
{
|
||||
return 'Total Screenings';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the ranges available for the metric.
|
||||
*/
|
||||
public function ranges(): array
|
||||
{
|
||||
return [
|
||||
30 => '30 Days',
|
||||
60 => '60 Days',
|
||||
365 => '365 Days',
|
||||
'TODAY' => 'Today',
|
||||
'ALL' => 'All Time',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine the amount of time the results should be cached.
|
||||
*/
|
||||
public $cacheFor = null;
|
||||
}
|
||||
35
app/Nova/Metrics/TotalSessions.php
Normal file
35
app/Nova/Metrics/TotalSessions.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Nova\Metrics;
|
||||
|
||||
use App\Models\Session;
|
||||
use Laravel\Nova\Http\Requests\NovaRequest;
|
||||
use Laravel\Nova\Metrics\Value;
|
||||
|
||||
final class TotalSessions extends Value
|
||||
{
|
||||
public function calculate(NovaRequest $request): mixed
|
||||
{
|
||||
return $this->count($request, Session::class);
|
||||
}
|
||||
|
||||
public function name(): string
|
||||
{
|
||||
return 'Total Sessions';
|
||||
}
|
||||
|
||||
public function ranges(): array
|
||||
{
|
||||
return [
|
||||
30 => '30 Days',
|
||||
60 => '60 Days',
|
||||
365 => '365 Days',
|
||||
'TODAY' => 'Today',
|
||||
'ALL' => 'All Time',
|
||||
];
|
||||
}
|
||||
|
||||
public $cacheFor = null;
|
||||
}
|
||||
Reference in New Issue
Block a user