I have a fresh Laravel installation. I have moved over code from a github repository that is a Laravel project, same version (5.3).
Everything works fine, except for some reason the database seeds wont' run.
For example, I can migrate from the github loaded migrations in the new Laravel installation, just as I would on the server that pushed the migrations to github in the first place.
But I can't do php artisan db:seed
, which means my beautiful little database is empty! >:(
I get: ReflectionException Class does not exist
What I have tried:
php artisan optimize
php artisan clear:cache
composer clearcache
composer dump-autoload
None of which have solved my problem. Everything in DatabaseSeeder
is spelled correctly and the classes -do- exist, they work fine on my other server, and again, this fresh install now has all the same files as my origin server, thanks to Github.
DatabaseSeeder.php:
<?php
use Illuminate\Database\Seeder;
class DatabaseSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$this->call(UserTableSeeder::class);
}
}
Edit - Stack Trace:
2017-06-14 19:11:00] local.ERROR: ReflectionException: Class UserTablesSeeder does not exist in /var/www/laravel/vendor/laravel/framework/src/Illuminate/Container/Container.php:749
Stack trace:
#0 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Container/Container.php(749): ReflectionClass->__construct('UserTablesSeede...')
#1 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Container/Container.php(644): Illuminate\Container\Container->build('UserTablesSeede...', Array)
#2 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(709): Illuminate\Container\Container->make('UserTablesSeede...', Array)
#3 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Database/Seeder.php(55): Illuminate\Foundation\Application->make('UserTablesSeede...')
#4 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Database/Seeder.php(43): Illuminate\Database\Seeder->resolve('UserTablesSeede...')
#5 /var/www/laravel/database/seeds/DatabaseSeeder.php(14): Illuminate\Database\Seeder->call('UserTablesSeede...')
#6 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Database/Console/Seeds/SeedCommand.php(63): DatabaseSeeder->run()
#7 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(2292): Illuminate\Database\Console\Seeds\SeedCommand->Illuminate\Database\Console\Seeds\{closure}()
#8 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Database/Console/Seeds/SeedCommand.php(64): Illuminate\Database\Eloquent\Model::unguarded(Object(Closure))
#9 [internal function]: Illuminate\Database\Console\Seeds\SeedCommand->fire()
#10 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Container/Container.php(508): call_user_func_array(Array, Array)
#11 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Console/Command.php(169): Illuminate\Container\Container->call(Array)
#12 /var/www/laravel/vendor/symfony/console/Command/Command.php(261): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#13 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Console/Command.php(155): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#14 /var/www/laravel/vendor/symfony/console/Application.php(817): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#15 /var/www/laravel/vendor/symfony/console/Application.php(185): Symfony\Component\Console\Application->doRunCommand(Object(Illuminate\Database\Console\Seeds\SeedCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#16 /var/www/laravel/vendor/symfony/console/Application.php(116): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#17 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(121): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#18 /var/www/laravel/artisan(35): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#19 {main}
try running
composer dump-autoload
especially if you have recently edited the name of your seeder file
I got around the problem by picking out an individual class:
php artisan db:seed --class=UserTableSeeder
As oppose to db:seed
without any arguments, however I would still like to know why I have to do this.
Again, I don't have UserTablesSeeder
anywhere in my code so not sure why the log shows this is the seed attempt when I never declare that.
It's always UserTableSeeder
without the s
in Table
.
Edit: And now my custom middleware doesn't work... seems to be an issue with the fresh install not liking some of the new code from github... if anyone can provide a better answer I will gladly accept.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With