-
-
Save michaeldyrynda/381024012249661a52fed7351c3e39a5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
return [ | |
'driver' => env('CONNECTION_DB_DRIVER', 'mysql'), | |
'host' => env('CONNECTION_DB_HOST', env('DB_HOST', '127.0.0.1')), | |
'port' => env('CONNECTION_DB_PORT', env('DB_PORT', '3306')), | |
'database' => env('CONNECTION_DB_DATABASE', env('DB_DATABASE', 'forge')), | |
'username' => env('CONNECTION_DB_USERNAME', env('DB_USERNAME', 'forge')), | |
'password' => env('CONNECTION_DB_PASSWORD', env('DB_PASSWORD', '')), | |
'unix_socket' => env('CONNECTION_DB_SOCKET', env('DB_SOCKET', '')), | |
'charset' => 'latin1', | |
'collation' => 'latin1_swedish_ci', | |
'prefix' => '', | |
'strict' => false, | |
'engine' => null, | |
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Mithrandir\Providers; | |
class ConnectionServiceProvider extends MithrandirServiceProvider | |
{ | |
protected $connectionName = 'connection'; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Mithrandir\Providers; | |
use Illuminate\Support\ServiceProvider; | |
class MithrandirServiceProvider extends ServiceProvider | |
{ | |
protected $connectionName; | |
public function boot() | |
{ | |
$this->loadMigrationsFrom($this->migrationPath()); | |
} | |
public function register() | |
{ | |
$this->mergeConfigFrom($this->configPath(), $this->configKey()); | |
} | |
protected function migrationPath() | |
{ | |
return dirname(__FILE__)."/../../database/migrations/{$this->connectionName}"; | |
} | |
protected function configPath() | |
{ | |
return dirname(__FILE__)."/../../config/{$this->connectionName}.php"; | |
} | |
protected function configKey($prefix = 'database.connections') | |
{ | |
return "{$prefix}.{$this->connectionName}"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment