From dd14237ed223b7ff6d0e001bf9c64bed5c52e772 Mon Sep 17 00:00:00 2001 From: denisdulici Date: Fri, 27 Mar 2020 01:14:44 +0300 Subject: [PATCH] added factories to provider stub --- app/Console/Stubs/Modules/scaffold/provider.stub | 15 +++++++++++++++ config/module.php | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/app/Console/Stubs/Modules/scaffold/provider.stub b/app/Console/Stubs/Modules/scaffold/provider.stub index 4fe695849..28628c39e 100644 --- a/app/Console/Stubs/Modules/scaffold/provider.stub +++ b/app/Console/Stubs/Modules/scaffold/provider.stub @@ -16,6 +16,7 @@ class $NAME$ extends Provider $this->loadViews(); $this->loadTranslations(); $this->loadMigrations(); + $this->loadFactories(); } /** @@ -58,6 +59,20 @@ class $NAME$ extends Provider $this->loadMigrationsFrom(__DIR__ . '/../$MIGRATIONS_PATH$'); } + /** + * Load factories. + * + * @return void + */ + public function loadFactories() + { + if (app()->environment('production') || !app()->runningInConsole()) { + return; + } + + $this->loadFactoriesFrom(__DIR__ . '/../$FACTORIES_PATH$'); + } + /** * Load routes. * diff --git a/config/module.php b/config/module.php index 2a9107617..26c54b946 100644 --- a/config/module.php +++ b/config/module.php @@ -98,7 +98,7 @@ return [ 'command' => ['path' => 'Console', 'generate' => true], 'migration' => ['path' => 'Database/Migrations', 'generate' => true], 'seeder' => ['path' => 'Database/Seeds', 'generate' => true], - 'factory' => ['path' => 'Database/Factories', 'generate' => false], + 'factory' => ['path' => 'Database/Factories', 'generate' => true], 'model' => ['path' => 'Models', 'generate' => true], 'controller' => ['path' => 'Http/Controllers', 'generate' => true], 'middleware' => ['path' => 'Http/Middleware', 'generate' => false],