我正在尝试按照此处的说明播种我的数据库:http: //laravel.com/docs/migrations#database-seeding。但是,当我运行 artisan 命令时,出现错误:
c:\wamp\www\laravel>php artisan db:seed
PHP Fatal error: Class 'Monolog\Logger' not found in C:\wamp\www\laravel\vendor
\laravel\framework\src\Illuminate\Log\LogServiceProvider.php on line 21
PHP Stack trace:
PHP 1. {main}() C:\wamp\www\laravel\artisan:0
PHP 2. require_once() C:\wamp\www\laravel\artisan:30
PHP 3. require() C:\wamp\www\laravel\bootstrap\start.php:61
PHP 4. Illuminate\Foundation\ProviderRepository->load() C:\wamp\www\laravel\ve
ndor\laravel\framework\src\Illuminate\Foundation\start.php:195
PHP 5. Illuminate\Foundation\Application->register() C:\wamp\www\laravel\vendo
r\laravel\framework\src\Illuminate\Foundation\ProviderRepository.php:67
PHP 6. Illuminate\Log\LogServiceProvider->register() C:\wamp\www\laravel\vendo
r\laravel\framework\src\Illuminate\Foundation\Application.php:336
{"error":{"type":"Symfony\\Component\\Debug\\Exception\\FatalErrorException","me
ssage":"Class 'Monolog\\Logger' not found","file":"C:\\wamp\\www\\laravel\\vendo
r\\laravel\\framework\\src\\Illuminate\\Log\\LogServiceProvider.php","line":21}}
任何建议如何解决这个问题?
更新 1:
即使使用文档中的示例代码也存在错误:
class DatabaseSeeder extends Seeder {
public function run()
{
$this->call('UserTableSeeder');
$this->command->info('User table seeded!');
}
}
class UserTableSeeder extends Seeder {
public function run()
{
DB::table('users')->delete();
User::create(array('email' => 'foo@bar.com'));
}
}