Search code examples
phplaravellaravel-5laravel-artisanlaravel-seeding

Command "db:seed" don't work at hosting


Rather works, but it is not accurate. I created many migrations on the local server and debugged them by

php artisan migrate

and

php artisan migrate:reset.

Everything works, no problem. Next, I created classes to fill the tables in the seeds folder. And, consequently, I tested the script for loading data into the database:

php artisan db:seed.

Here, too, everything works fine, the site after these tests is displayed as before. Next, I upload all these changes to the hosting. I note that up to this point this project was already on hosting, but I imported the database there using MySQL. And there it was also displayed perfectly. And now I wanted to test the migration and filling the initial data on the host server. All this is done, of course, by SSH. And what is surprising

php artisan migrate

and

php artisan migrate:reset

work on the hosting correctly, the tables are deleted and created without errors. And when i try to run

php artisan db:seed

The first class in the list of the run() method of the DatabaseSeeder class does not already see the script and I get this error:

Class UsersTableSeeder does not exist

And all other classes are also out of range.


Solution

  • You likely have an old autoload file prior to uploading the new code. Try php artisan cache:clear and composer dumpautoload. If those fail, delete the contents of the bootstrap/cache directory and rerun those two commands.