match up db named/seeder to installer names/env names

This commit is contained in:
Nabeel Shahzad
2017-12-04 15:35:39 -06:00
parent 9c1a8f8251
commit 3849b55c50
4 changed files with 27 additions and 11 deletions
+1 -2
View File
@@ -62,6 +62,7 @@ return [
Spatie\Fractal\FractalServiceProvider::class, Spatie\Fractal\FractalServiceProvider::class,
SebastiaanLuca\Helpers\Methods\GlobalHelpersServiceProvider::class, SebastiaanLuca\Helpers\Methods\GlobalHelpersServiceProvider::class,
SebastiaanLuca\Helpers\Collections\CollectionMacrosServiceProvider::class, SebastiaanLuca\Helpers\Collections\CollectionMacrosServiceProvider::class,
Toin0u\Geotools\GeotoolsServiceProvider::class,
/* /*
* Application Service Providers... * Application Service Providers...
@@ -71,8 +72,6 @@ return [
App\Providers\AuthServiceProvider::class, App\Providers\AuthServiceProvider::class,
App\Providers\EventServiceProvider::class, App\Providers\EventServiceProvider::class,
App\Providers\RouteServiceProvider::class, App\Providers\RouteServiceProvider::class,
Toin0u\Geotools\GeotoolsServiceProvider::class,
], ],
'aliases' => [ 'aliases' => [
+7 -1
View File
@@ -21,9 +21,15 @@ return [
'engine' => null, 'engine' => null,
], ],
'sqlite' => [
'driver' => 'sqlite',
'database' => storage_path('db.sqlite'),
'prefix' => '',
],
'local' => [ 'local' => [
'driver' => 'sqlite', 'driver' => 'sqlite',
'database' => storage_path('testing.sqlite'), 'database' => storage_path('local.sqlite'),
'prefix' => '', 'prefix' => '',
], ],
+5 -5
View File
@@ -68,11 +68,11 @@ return [
'app_log_level' => 'required|string|max:50', 'app_log_level' => 'required|string|max:50',
'app_url' => 'required|url', 'app_url' => 'required|url',
'database_connection' => 'required|string|max:50', 'database_connection' => 'required|string|max:50',
'database_hostname' => 'required|string|max:50', 'database_hostname' => 'string|max:50',
'database_port' => 'required|numeric', 'database_port' => 'numeric',
'database_name' => 'required|string|max:50', 'database_name' => 'string|max:50',
'database_username' => 'required|string|max:50', 'database_username' => 'string|max:50',
'database_password' => 'required|string|max:50', 'database_password' => 'string|max:50',
'broadcast_driver' => 'string|max:50', 'broadcast_driver' => 'string|max:50',
'cache_driver' => 'string|max:50', 'cache_driver' => 'string|max:50',
'session_driver' => 'string|max:50', 'session_driver' => 'string|max:50',
+14 -3
View File
@@ -4,14 +4,26 @@ use Illuminate\Database\Seeder;
class DatabaseSeeder extends 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. * Run the database seeds.
*
* @return void
*/ */
public function run() public function run()
{ {
$env = App::environment(); $env = App::environment();
if(in_array($env, self::$seed_mapper, true)) {
$env = self::$seed_mapper[$env];
}
$path = database_path('seeds/'.$env.'.yml'); $path = database_path('seeds/'.$env.'.yml');
print("Seeding seeds/$env.yml\n"); print("Seeding seeds/$env.yml\n");
@@ -22,5 +34,4 @@ class DatabaseSeeder extends Seeder
$svc = app('App\Services\DatabaseService'); $svc = app('App\Services\DatabaseService');
$svc->seed_from_yaml_file($path); $svc->seed_from_yaml_file($path);
} }
} }