laravel-shift / factory-generator

MIT License
41 stars 20 forks source link

Factories in subfolders get the wrong namespace #18

Closed mortenscheel closed 3 years ago

mortenscheel commented 3 years ago

Possibly related to #1

The directory structure of the factories does mirror the models, so if the model is in app/Feature/Models, the factory is created in database/factories/Features/Models. Which is great.

But the factory namespace is

namespace Database\Factories;

And when calling App\Feature\Models\Foo::factory(), laravel resolves the factory to Database\Factories\Feature\Models\FooFactory, which doesn't exist.

jasonmccreary commented 3 years ago

This would be covered by #1. Feel free to open a PR if you have time.