Today I am getting this error when I am trying to refresh seed with php artisan migrate:refresh –seed command. Database Seeder class is called another seeder class with $this->call(CmsPagesSeeder::class); But geeting error Target class [CmsPagesSeeder] does not exist.
Finally I have apply follwing solution and now working fine with command php artisan migrate:refresh –seed or php artisan db:seed or php artisan db:seed –class=CmsPagesSeeder
Laravel 8 Seeders and Factories are now need to add namespace at the top of class file.
Rename directory database/seeds to database/seeders
Open composer.json file and change on autoload section.
Open Database Seeder file database/seeders/DatabaseSeeder.php and add namespace Database\Seeders; on top of page.
Open your others seeders file and add namespace Database\Seeders; to all seeders class.
Done! Now run following commands you can see now DB seeder is working fine.
Thank you for carefully read my article If you have any query please Leave your query on following comment section or contact with us. Please LIKE and SHARE