From 9ab8b6ff1b4482adac5278afd93643b8b6790656 Mon Sep 17 00:00:00 2001 From: Jasper Tey Date: Fri, 15 Nov 2024 21:46:09 -0500 Subject: [PATCH] Try limiting run() --- src/Support/AutoloadManager.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/Support/AutoloadManager.php b/src/Support/AutoloadManager.php index 45f299b..83e9e5f 100644 --- a/src/Support/AutoloadManager.php +++ b/src/Support/AutoloadManager.php @@ -38,6 +38,8 @@ class AutoloadManager protected bool $consoleBooted = false; + protected bool $ran = false; + public function __construct() { $this->appNamespace = $this->resolveAppNamespace(); @@ -70,6 +72,11 @@ public function isConsoleBooted(): bool return $this->consoleBooted; } + public function hasRun(): bool + { + return $this->ran; + } + protected function flush() { foreach (static::$registeredProviders as $provider) { @@ -147,6 +154,10 @@ protected function handleCommands() protected function run() { + if ($this->hasRun()) { + return $this; + } + foreach (static::$registeredProviders as $provider) { app()->register($provider); } @@ -161,6 +172,8 @@ protected function run() $this->consoleBooted = true; } + $this->ran = true; + return $this; }