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],