diff --git a/app/Filament/Pages/Dashboard.php b/app/Filament/Pages/Dashboard.php index df07f4c32..9ab14589f 100644 --- a/app/Filament/Pages/Dashboard.php +++ b/app/Filament/Pages/Dashboard.php @@ -11,6 +11,8 @@ use App\Filament\Widgets\RecentUploadChartWidget; use App\Filament\Widgets\RecentUploadLatencyChartWidget; use App\Filament\Widgets\StatsOverviewWidget; +use Carbon\Carbon; +use Cron\CronExpression; use Filament\Actions\Action; use Filament\Actions\ActionGroup; use Filament\Notifications\Notification; @@ -24,6 +26,19 @@ class Dashboard extends BasePage protected static string $view = 'filament.pages.dashboard'; + public function getSubheading(): ?string + { + if (blank(config('speedtest.schedule'))) { + return __('No speedtests scheduled.'); + } + + $cronExpression = new CronExpression(config('speedtest.schedule')); + + $nextRunDate = Carbon::parse($cronExpression->getNextRunDate(timeZone: config('app.display_timezone')))->format(config('app.datetime_format')); + + return 'Next speedtest at: '.$nextRunDate; + } + protected function getHeaderActions(): array { return [