laravel = $laravel; $this->events = $events; $this->setAutoExit(false); $this->setCatchExceptions(false); $this->events->dispatch(new ArtisanStarting($this)); $this->bootstrap(); } /** * Inject the Laravel container into commands as they are registered. * * symfony/console 7.4 renamed add() to addCommand() and routes the lazy command-loader * path (Application::has() -> commandLoader->get()) through addCommand(), but * Illuminate\Console\Application only overrides the deprecated add() — the single place * setLaravel() is called. The result is that lazily-resolved #[AsCommand] commands run * with a null $laravel and fatal in Command::run(). Mirroring Illuminate's add() here on * addCommand() closes that gap for every registration path (add() delegates here too). */ public function addCommand(callable|SymfonyCommand $command): ?SymfonyCommand { if ($command instanceof IlluminateCommand) { $command->setLaravel($this->laravel); } return parent::addCommand($command); } /** * Runs the current application. * * @return int 0 if everything went fine, or an error code */ public function doRun(InputInterface $input, OutputInterface $output): int { // $this->setDomain($input); self::dispatchEvent('beforeRun', ['application' => $this, 'input' => $input, 'output' => $output]); /* wrapper for future use */ return parent::doRun($input, $output); } protected function getDefaultInputDefinition(): InputDefinition { $definition = parent::getDefaultInputDefinition(); $definition->addOption(new InputOption('--domain', null, InputOption::VALUE_OPTIONAL, 'Set domain for config')); return $definition; } protected function bootstrap() { foreach (static::$bootstrappers as $bootstrapper) { $bootstrapper($this); } } public static function artisanBinary() { return ProcessUtils::escapeArgument('bin/leantime'); } }