2017-06-09 02:28:26 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
use Illuminate\Database\Seeder;
|
|
|
|
|
|
|
|
class DatabaseSeeder extends Seeder
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Run the database seeds.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function run()
|
|
|
|
{
|
2017-06-25 01:59:07 +08:00
|
|
|
$env = App::environment();
|
2017-06-20 00:50:25 +08:00
|
|
|
$path = database_path('seeds/'.$env.'.yml');
|
2017-06-25 01:59:07 +08:00
|
|
|
if(!file_exists($path)) {
|
2017-07-14 07:09:08 +08:00
|
|
|
$path = database_path('seeds/prod.yml');
|
2017-06-20 00:50:25 +08:00
|
|
|
}
|
2017-06-25 01:59:07 +08:00
|
|
|
|
|
|
|
$svc = app('App\Services\DatabaseService');
|
2017-06-25 02:20:24 +08:00
|
|
|
$svc->seed_from_yaml_file($path);
|
2017-06-12 00:36:16 +08:00
|
|
|
}
|
2017-06-14 22:39:02 +08:00
|
|
|
|
2017-06-09 02:28:26 +08:00
|
|
|
}
|