1. Go to this page and download the library: Download code-distortion/swap-con library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
code-distortion / swap-con example snippets
php
// alter the connection for a particular query
DB::connection('mysql2')->table('users')->all();
php
// hard-code the connection a model uses
class SomeModel extends Eloquent {
protected $connection = 'mysql2';
}
// or change the connection for a particular model instance
$someModel = new SomeModel;
$someModel->setConnection('mysql2');
$someModel->find(1);