From 91e580372ef336562f6e5d19b094d3fdf0954dca Mon Sep 17 00:00:00 2001 From: Philipp Daun Date: Sat, 26 Sep 2026 13:30:02 +0200 Subject: [PATCH] Resolve outpost lazily --- src/Licensing/Radio.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Licensing/Radio.php b/src/Licensing/Radio.php index 4acc4258a65..617417f3d9e 100644 --- a/src/Licensing/Radio.php +++ b/src/Licensing/Radio.php @@ -16,10 +16,15 @@ class Radio const PING_CACHE_KEY = 'statamic.outpost.pinged'; const PING_INTERVAL = 300; // seconds - public function __construct(private Outpost $outpost) + public function __construct(private ?Outpost $outpost = null) { } + private function outpost(): Outpost + { + return $this->outpost ??= app(Outpost::class); + } + public function ping(): void { if (! $this->markAsPinged()) { @@ -39,7 +44,7 @@ public function forcePing(): void private function contactOutpost(): void { try { - $this->outpost->radio(); + $this->outpost()->radio(); } catch (Throwable $e) { Log::debug('Error contacting Outpost: '.$e->getMessage()); }