php artisan db:seed
Fix 1: Run composer dump-autoload
The easy way to fix this "Class Seeder Does not Exist" error is to run the composer dump-autoload and this command will regenerate the list of all classes that need to be included in the project.
php artisan dump-autoload
Fix 2: Update Namespace For Seeder
If you are not using Laravel 8 then you can update the namespace for the seeder. Below is the seeder namespace and you can reference this namespace from within the composer JSON autoload function.
<?php namespace Database\Seeders;
"autoload": { "psr-4": { "App\\": "app/", "Database\\Seeders\\": "database/seeds/" } },
Fix 3: Specify your Seeder Class
Sometimes you might can just explicitly specify your seeder class and it's like the following. Do note that using this method you will have to run your seeder one by one.
php artisan db:seed --class=UsersTableSeeder
Leave a reply