Laravel 5 - artisan seed [ReflectionException] Class SongsTableSeeder does not exist
You need to put SongsTableSeeder
into file SongsTableSeeder.php
in the same directory where you have your DatabaseSeeder.php
file.
And you need to run in your console:
composer dump-autoload
to generate new class map and then run:
php artisan db:seed
I've just tested it. It is working without a problem in Laravel 5
I solved it by doing this:
- Copy the file content.
- Remove file.
- Run command: php artisan make:seeder .
- Copy the file content back in this file.
This happened because I made a change in the filename. I don't know why it didn't work after the change.
File SongsTableSeeder.php should be in database/seeds directory or in its subdirectory.
You need to run:
composer dump-autoload
and then:
php artisan db:seed
or:
php artisan db:seed --class=SongsTableSeeder