app = $app; // Capture the request and instantiate the correct type $request = IncomingRequest::capture(); // Use the right kernel for the job and handle the request. $this->handleRequest($request); self::dispatchEvent('end', ['bootloader' => $this]); } /** * Handle the request * * @throws BindingResolutionException */ private function handleRequest($request): void { if (! $this->app->runningInConsole()) { /** @var HttpKernel $kernel */ $kernel = $this->app->make(HttpKernel::class); $kernelHandler = $kernel->handle($request); $response = $kernelHandler->send(); $kernel->terminate($request, $response); } else { /** @var ConsoleKernel $kernel */ $kernel = $this->app->make(ConsoleKernel::class); $status = $kernel->handle( $input = new \Symfony\Component\Console\Input\ArgvInput, new \Symfony\Component\Console\Output\ConsoleOutput ); $kernel->terminate($input, $status); exit($status); } } }