database seeder issue
satis-apex opened this issue · comments
this is example this is Setting module
inside module composer autoload
"autoload": {
"psr-4": {
"Modules\Setting\": "app/",
"Modules\Setting\Database\Factories\": "database/factories/",
"Modules\Setting\Database\Seeders\": "database/seeders/"
}
},
"Database"and "Seeders " both have initials in capital but
inside auto-generated seeder file has the namespace is set to
"namespace Modules\Setting\database\seeders;"
due to this the seeder is not working as it supposed to and as a workaround, I have to manually change namespace to
"namespace Modules\Setting\Database\Seeders;"
I also tried to change module composer as below from stubs and did composer dump but did not work
"autoload": {
"psr-4": {
"Modules\Setting\": "app/",
"Modules\Setting\database\factories\": "database/factories/",
"Modules\Setting\database\seeders\": "database/seeders/"
}
},
I am also experiencing the same issue.
The only solution that has worked (so far) is to change the name spaces manually
okay got to the bottom of it, adding in a namespace to the generators path corrected this.
I'll update the config in the package, for your own files update:
'seeder' => ['path' => 'database/seeders', 'namespace' => 'Database\Seeders', 'generate' => true],
'factory' => ['path' => 'database/factories', 'namespace' => 'Database\Factories', 'generate' => true],
released https://github.com/nWidart/laravel-modules/releases/tag/11.0.4 will take care of the default config.