diff --git a/src/Commands/OptimizeCommand.php b/src/Commands/OptimizeCommand.php index b36f7cd..58b2245 100644 --- a/src/Commands/OptimizeCommand.php +++ b/src/Commands/OptimizeCommand.php @@ -3,7 +3,7 @@ namespace Lunarstorm\LaravelDDD\Commands; use Illuminate\Console\Command; -use Lunarstorm\LaravelDDD\Facades\DDD; +use Lunarstorm\LaravelDDD\Facades\Autoload; use Lunarstorm\LaravelDDD\Support\DomainMigration; class OptimizeCommand extends Command @@ -24,8 +24,8 @@ protected function configure() public function handle() { $this->components->info('Caching DDD providers, commands, migration paths.'); - $this->components->task('domain providers', fn () => DDD::autoloader()->cacheProviders()); - $this->components->task('domain commands', fn () => DDD::autoloader()->cacheCommands()); + $this->components->task('domain providers', fn () => Autoload::cacheProviders()); + $this->components->task('domain commands', fn () => Autoload::cacheCommands()); $this->components->task('domain migration paths', fn () => DomainMigration::cachePaths()); $this->newLine(); } diff --git a/src/Support/AutoloadManager.php b/src/Support/AutoloadManager.php index f35351d..25a7074 100644 --- a/src/Support/AutoloadManager.php +++ b/src/Support/AutoloadManager.php @@ -48,9 +48,9 @@ class AutoloadManager * @param \Illuminate\Contracts\Foundation\Application $app * @return void */ - public function __construct($app) + public function __construct($app = null) { - $this->app = $app; + $this->app = $app ?? Container::getInstance()->make(Application::class); $this->appNamespace = $this->app->getNamespace(); }