PHP Schema::setConnection Examples

PHP Schema::setConnection - 3 examples found. These are the top rated real world PHP examples of Schema::setConnection extracted from open source projects. You can rate examples to help us improve the quality of examples.

setConnection() public static method

Set the database connection instance.
public static setConnection ( Connection $connection )
$connection illuminate\database\Connection
Example #1
0
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     $config = (require __DIR__ . '/../config.php');
     $capsule = new Manager();
     $capsule->addConnection($config);
     $capsule->bootEloquent();
     Schema::setConnection($capsule->getConnection('default'));
     DB::setConnection($capsule->getConnection('default'));
     // run the migrations
     $migration_repo = new DatabaseMigrationRepository(Model::getConnectionResolver(), 'migrations');
     if (!$migration_repo->repositoryExists()) {
         $migration_repo->createRepository();
     }
     $migrator = new Migrator($migration_repo, Model::getConnectionResolver(), new Filesystem());
     $migrator->rollback();
     $migrator->run(__DIR__ . '/../../src/migrations');
     static::loadFixtures();
 }
 /**
  * Reverse the migrations.
  *
  * @return void
  */
 public function down()
 {
     Schema::setConnection(DB::connection(Config::get('econt.connection')))->dropIfExists('econt_regions');
 }
 /**
  * Reverse the migrations.
  *
  * @return void
  */
 public function down()
 {
     Schema::setConnection(DB::connection(Config::get('laravel-currency.laravel-currency.connection')))->dropIfExists('currencies');
 }