Skip to content

Commit

Permalink
Allow null for console environments.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaspertey committed Nov 16, 2024
1 parent c6c08a4 commit cf39cb2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/Commands/OptimizeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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();
}
Expand Down
4 changes: 2 additions & 2 deletions src/Support/AutoloadManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down

0 comments on commit cf39cb2

Please sign in to comment.