Skip to content

Commit 58227ba

Browse files
authored
[Feature] Display next speedtest run at date on dashboard (alexjustesen#1477)
1 parent 9b51bb8 commit 58227ba

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

app/Filament/Pages/Dashboard.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
use App\Filament\Widgets\RecentUploadChartWidget;
1212
use App\Filament\Widgets\RecentUploadLatencyChartWidget;
1313
use App\Filament\Widgets\StatsOverviewWidget;
14+
use Carbon\Carbon;
15+
use Cron\CronExpression;
1416
use Filament\Actions\Action;
1517
use Filament\Actions\ActionGroup;
1618
use Filament\Notifications\Notification;
@@ -24,6 +26,19 @@ class Dashboard extends BasePage
2426

2527
protected static string $view = 'filament.pages.dashboard';
2628

29+
public function getSubheading(): ?string
30+
{
31+
if (blank(config('speedtest.schedule'))) {
32+
return __('No speedtests scheduled.');
33+
}
34+
35+
$cronExpression = new CronExpression(config('speedtest.schedule'));
36+
37+
$nextRunDate = Carbon::parse($cronExpression->getNextRunDate(timeZone: config('app.display_timezone')))->format(config('app.datetime_format'));
38+
39+
return 'Next speedtest at: '.$nextRunDate;
40+
}
41+
2742
protected function getHeaderActions(): array
2843
{
2944
return [

0 commit comments

Comments
 (0)