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; }