This might help https://twitter.com/wylesone/status/1303610973736128512?s=21
Factory for model with custom namespace in Laravel 8
Hi all!
I have a little problem with new factories.
My models has custom namespaces like App\Domain\Product\Models\Product. And i want use a simple factory namespaces like \Database\Factories\ProductFactory.
When i try to make them from seed class:
Product::factory()->count(15)->create();
I get an error:
Class 'Database\Factories\Domain\Product\Models\ProductFactory' not found
But i dont want make so many folders, i want use Database\Factories\ProductFactory class.
When i make factory object manually, it works:
app(\Database\Factories\ProductFactory::class)->count(15)->create();
So, is there any way to use Model::factory() method and get \Database\Factories\ModelFactory object? Only delete new trait and make my own factory method?
Thanks!
Please or to participate in this conversation.