在更新到 Laravel 5.3 后,在设定种子时调用未定义的方法 Illuminate\Database\Query\Builder::lists()
2022-08-30 12:20:39
我正在更新到 laravel 5.3,我收到以下消息:
[2016-08-23 23:12:39] local.ERROR: BadMethodCallException: Call to undefined method Illuminate\Database\Query\Builder::lists() in /home/vagrant/Code/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php:2431
Stack trace:
#0 [internal function]: Illuminate\Database\Query\Builder->__call('lists', Array)
#1 /home/vagrant/Code/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(1423): call_user_func_array(Array, Array)
#2 /home/vagrant/Code/vendor/cviebrock/eloquent-sluggable/src/SluggableTrait.php(254): Illuminate\Database\Eloquent\Builder->__call('lists', Array)
#3 /home/vagrant/Code/vendor/cviebrock/eloquent-sluggable/src/SluggableTrait.php(170): App\User->getExistingSlugs('nouseratnouser-...')
#4 /home/vagrant/Code/vendor/cviebrock/eloquent-sluggable/src/SluggableTrait.php(312): App\User->makeSlugUnique('nouseratnouser-...')
#5 /home/vagrant/Code/vendor/cviebrock/eloquent-sluggable/src/SluggableServiceProvider.php(72): App\User->sluggify()
#6 [internal function]: Cviebrock\EloquentSluggable\SluggableServiceProvider->Cviebrock\EloquentSluggable\{closure}(Object(App\User))
#7 /home/vagrant/Code/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php(221): call_user_func_array(Object(Closure), Array)
#8 /home/vagrant/Code/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php(164): Illuminate\Events\Dispatcher->fire('eloquent.saving...', Array, true)
#9 /home/vagrant/Code/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1664): Illuminate\Events\Dispatcher->until('eloquent.saving...', Object(App\User))
#10 /home/vagrant/Code/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1456): Illuminate\Database\Eloquent\Model->fireModelEvent('eloquent.saving...')
#11 /home/vagrant/Code/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(562): Illuminate\Database\Eloquent\Model->save()
#12 /home/vagrant/Code/database/seeds/UserSeeder.php(34): Illuminate\Database\Eloquent\Model::create(Array)
#13 /home/vagrant/Code/vendor/laravel/framework/src/Illuminate/Database/Seeder.php(39): UserSeeder->run()
#14 /home/vagrant/Code/database/seeds/DatabaseSeeder.php(37): Illuminate\Database\Seeder->call('UserSeeder')
#15 /home/vagrant/Code/vendor/laravel/framework/src/Illuminate/Database/Console/Seeds/SeedCommand.php(63): DatabaseSeeder->run()
#16 /home/vagrant/Code/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(2279): Illuminate\Database\Console\Seeds\SeedCommand->Illuminate\Database\Console\Seeds\{closure}()
#17 /home/vagrant/Code/vendor/laravel/framework/src/Illuminate/Database/Console/Seeds/SeedCommand.php(64): Illuminate\Database\Eloquent\Model::unguarded(Object(Closure))
#18 [internal function]: Illuminate\Database\Console\Seeds\SeedCommand->fire()
#19 /home/vagrant/Code/vendor/laravel/framework/src/Illuminate/Container/Container.php(507): call_user_func_array(Array, Array)
#20 /home/vagrant/Code/vendor/laravel/framework/src/Illuminate/Console/Command.php(169): Illuminate\Container\Container->call(Array)
#21 /home/vagrant/Code/vendor/symfony/console/Command/Command.php(256): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#22 /home/vagrant/Code/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))
#23 /home/vagrant/Code/vendor/symfony/console/Application.php(818): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#24 /home/vagrant/Code/vendor/symfony/console/Application.php(186): Symfony\Component\Console\Application->doRunCommand(Object(Illuminate\Database\Console\Seeds\SeedCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#25 /home/vagrant/Code/vendor/symfony/console/Application.php(117): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#26 /home/vagrant/Code/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(111): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#27 /home/vagrant/Code/artisan(35): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#28 {main}
我检查了导致它的代码:
User::create([
'name' => 'No User',
'email' => 'nouser@nouser.com',
'password' => bcrypt('0'),
'provider' => '0',
]);
我不明白为什么。
如果我评论它,我会在另一个文件中遇到同样的问题:
Tournament::create([
'user_id' => 1,
'name' => "name",
'dateIni' => $dateIni,
'dateFin' => $dateIni,
]);
我对“列表”进行了全局搜索,但没有成功...
任何想法为什么会发生???