so when using the new model factories class introduced in laravel 8.x, ive this weird issue saying that laravel cannot find the factory that corresponds to the model. i get
If you upgraded to 8 from a previous version you are probably missing the autoload directive for the Database\Factories
namespace in composer.json
:
"autoload": {
"psr-4": {
"App\\": "app/",
"Database\\Factories\\": "database/factories/",
"Database\\Seeders\\": "database/seeders/"
}
},
You can also remove the classmap
part, since it is no longer needed.
Run composer dump
after making these changes.
Laravel 8.x Docs - Upgrade Guide - Database - Seeder and Factory Namespace