title: Calling passport:client from route, "there are no commands defined in the "passport" namespace"
body: <p>I have an issue where the <code>passport</code> namespace is not available when I call <code>passport:client</code>. I set up a brand new Laravel project with version 5.6.34 where I installed <a href="https://laravel.com/docs/5.6/passport#installation" rel="nofollow noreferrer">Laravel passport according to the documentation</a>. I also checked a <a href="https://stackoverflow.com/a/45121048/1260548">similar question</a> and followed all steps there with no sucess.</p>
  
  <p>Calling <code>php artisan passport:client --password --name="Test"</code> from the command line works without any issues and I can see the client in the database.</p>
  
  <p>However if I create a route in <code>routes/web.php</code> like so:</p>
  
  <pre><code>&lt;?php
  use Illuminate\Support\Facades\Route;
  use \Illuminate\Support\Facades\Artisan;
  
  Route::get('/', function () {
      Artisan::call('passport:client', [
          '--password' =&gt; true,
          '--name' =&gt; "Test client",
          '--quiet' =&gt; true,
      ]);
  });
  </code></pre>
  
  <p>and use the Artisan facade to call the command I get the error below when I navigate to <code>http://homestead.test/</code>.</p>
  
  <p><code>
  Symfony \ Component \ Console \ Exception \ CommandNotFoundException
  The command "passport:client" does not exist.
  </code></p>
  
  <p>I have added <code>Laravel\Passport\PassportServiceProvider::class</code> in the providers array in <code>config/app.php</code>.</p>
  
  <p><strong>How can I call the <code>passport:client</code> command from a web route?</strong></p>
  
  <p>We have a Laravel application that has several hundred database connections which are handled dynamically. In the admin interface you can create a new project and thus a new database where we need to generate a client.</p>
  
  <p>My other option is the instantiate a <code>ClientRepository</code> and call the <code>createPasswordGrantClient()</code> method but I would like to avoid this if possible. I am curious to know why the namespace is available when called on the CLI but not via a request. I can call other commands such as <code>migrate:fresh</code> via a request but <code>passport:client</code> will fail even if it is part of the migration or inside another command.</p>