title: Create Dynamic database and run existing migrations laravel
body: <p>I've an application in that Admin can create new users and after created new user I want to create separate databases for each user created, and I've some migrations(tables) in the user application. So After creating new database I'm not able to run the users migration in new database.</p>
  
  <pre><code> DB::statement('create database ' .$dbName ); // with this I'm creating new db and after this I've some command like this:
   Artisan::call('migrate', ['--database' =&gt; $new_connection]);*
  </code></pre>
  
  <p>It's creating database but it's not creating any migrations in this database. please help me in this.</p>
  
  <p>Example Code:</p>
  
  <pre><code>if (DB::statement('create database ' . $dbName) == true) {
      $new_connection = 'new';
      $nc = \Illuminate\Support\Facades\Config::set('database.connec‌​tions.' . $new_connect‌​ion, [
          'driver'   =&gt; 'mysql',
          'host'     =&gt; 'localhost',
          'database' =&gt; $dbName,
          'username' =&gt; 'root',
          'password' =&gt; '',
      ]);
      Artisan::call('migrate', ['--database' =&gt; $nc]);
  } else {
      return 'db already exists!';
  }
  </code></pre>