match up db named/seeder to installer names/env names
This commit is contained in:
parent
9c1a8f8251
commit
3849b55c50
@ -62,6 +62,7 @@ return [
|
||||
Spatie\Fractal\FractalServiceProvider::class,
|
||||
SebastiaanLuca\Helpers\Methods\GlobalHelpersServiceProvider::class,
|
||||
SebastiaanLuca\Helpers\Collections\CollectionMacrosServiceProvider::class,
|
||||
Toin0u\Geotools\GeotoolsServiceProvider::class,
|
||||
|
||||
/*
|
||||
* Application Service Providers...
|
||||
@ -71,8 +72,6 @@ return [
|
||||
App\Providers\AuthServiceProvider::class,
|
||||
App\Providers\EventServiceProvider::class,
|
||||
App\Providers\RouteServiceProvider::class,
|
||||
|
||||
Toin0u\Geotools\GeotoolsServiceProvider::class,
|
||||
],
|
||||
|
||||
'aliases' => [
|
||||
|
@ -21,9 +21,15 @@ return [
|
||||
'engine' => null,
|
||||
],
|
||||
|
||||
'sqlite' => [
|
||||
'driver' => 'sqlite',
|
||||
'database' => storage_path('db.sqlite'),
|
||||
'prefix' => '',
|
||||
],
|
||||
|
||||
'local' => [
|
||||
'driver' => 'sqlite',
|
||||
'database' => storage_path('testing.sqlite'),
|
||||
'database' => storage_path('local.sqlite'),
|
||||
'prefix' => '',
|
||||
],
|
||||
|
||||
|
@ -68,11 +68,11 @@ return [
|
||||
'app_log_level' => 'required|string|max:50',
|
||||
'app_url' => 'required|url',
|
||||
'database_connection' => 'required|string|max:50',
|
||||
'database_hostname' => 'required|string|max:50',
|
||||
'database_port' => 'required|numeric',
|
||||
'database_name' => 'required|string|max:50',
|
||||
'database_username' => 'required|string|max:50',
|
||||
'database_password' => 'required|string|max:50',
|
||||
'database_hostname' => 'string|max:50',
|
||||
'database_port' => 'numeric',
|
||||
'database_name' => 'string|max:50',
|
||||
'database_username' => 'string|max:50',
|
||||
'database_password' => 'string|max:50',
|
||||
'broadcast_driver' => 'string|max:50',
|
||||
'cache_driver' => 'string|max:50',
|
||||
'session_driver' => 'string|max:50',
|
||||
|
@ -4,14 +4,26 @@ use Illuminate\Database\Seeder;
|
||||
|
||||
class DatabaseSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Map these other environments to a specific seed file
|
||||
* @var array
|
||||
*/
|
||||
public static $seed_mapper = [
|
||||
'local' => 'dev',
|
||||
'qa' => 'dev',
|
||||
'staging' => 'dev',
|
||||
];
|
||||
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$env = App::environment();
|
||||
if(in_array($env, self::$seed_mapper, true)) {
|
||||
$env = self::$seed_mapper[$env];
|
||||
}
|
||||
|
||||
$path = database_path('seeds/'.$env.'.yml');
|
||||
print("Seeding seeds/$env.yml\n");
|
||||
|
||||
@ -22,5 +34,4 @@ class DatabaseSeeder extends Seeder
|
||||
$svc = app('App\Services\DatabaseService');
|
||||
$svc->seed_from_yaml_file($path);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user