title: How to use multiple database connections in the same \DB::statement()
body: <p>I'm trying to build a Laravel console command to copy the table schema from a remote database and create the table in my local database. Effectively, just to copy and paste the table.</p>
  
  <p>I have multiple database connections set up already in <code>config/database.php</code> and I use this in other parts of the projects, e.g. for model connections etc. That side of it is all fine.</p>
  
  <p>I know I can do <code>\DB::connection('connection_name')</code> to specify the connection for that query, but I need to work across two connections at the same time.</p>
  
  <p>I've tried putting this in in various places in the code, but I haven't been able to make it work.</p>
  
  <p>Below is the function that gets called. First we drop the local table, then recreate it with the schema from the remote database. That's the bit I'm stuck on - how to get the query to look at the remote table.</p>
  
  <pre><code>public function handle()
  {
      $this-&gt;table = $this-&gt;argument('table');
  
       //drop the local table first
          \DB::statement('DROP TABLE IF EXISTS ' . $this-&gt;table . ';');
  
          \DB::statement('CREATE TABLE ' . $this-&gt;table . ' LIKE        ??remote_db_connection??.'. $this-&gt;table . ';');
  }
  </code></pre>