Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel 8. Seeder class does not exist

Tags:

php

class

laravel

This problem is not new, but I’ve looked and tried all the proposed solutions in other threads with no success. I’m working with Laravel 8 with Homestead, is a new installation on a Windows 10 machine, not an upgrade. I’m trying to seed a file called HotelSeeder.php. When I run the command

php artisan db:seed

I get the next error:

Error

My HotelSeeder class goes like this:

HotelSeeder.php

My DatabaseSeeder class goes like this:

DatabaseSeeder.php

Both classes are located in the directory database/seeders

Autoload in composer.json goes like this:

Autoload

After I run vagrant up and vagrant ssh, the commands that I’m running are:

php composer auto-load

php artisan db:seed

And the error shows up.

I've tried also:

php artisan db:seed --class=HotelSeeder

php artisan migrate:fresh –seed

php artisan clear:cache

php artisan optimize

Nothing seems to work. I hope you can help me.

like image 325
arlokan Avatar asked Oct 17 '25 13:10

arlokan


1 Answers

Try the command:

composer dump-autoload --optimize

then:

php artisan db:seed
like image 153
Sergey Zakharevich Avatar answered Oct 20 '25 02:10

Sergey Zakharevich



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!