Skip to content

Commit

Permalink
Try limiting run()
Browse files Browse the repository at this point in the history
  • Loading branch information
jaspertey committed Nov 16, 2024
1 parent e11e6c0 commit 9ab8b6f
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/Support/AutoloadManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ class AutoloadManager

protected bool $consoleBooted = false;

protected bool $ran = false;

public function __construct()
{
$this->appNamespace = $this->resolveAppNamespace();
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -147,6 +154,10 @@ protected function handleCommands()

protected function run()
{
if ($this->hasRun()) {
return $this;
}

foreach (static::$registeredProviders as $provider) {
app()->register($provider);
}
Expand All @@ -161,6 +172,8 @@ protected function run()
$this->consoleBooted = true;
}

$this->ran = true;

return $this;
}

Expand Down

0 comments on commit 9ab8b6f

Please sign in to comment.