Laravel php artisan db:seed 导致 “use” 语句错误
2022-08-30 15:32:54
当我尝试运行时,我收到以下错误:php artisan db:seed
The use statement with non-compound name 'DB' has no effect
我根据文档中的片段编写了自己的播种器文件,并将其包含在下面。如您所见,我正在使用快捷方式 - 这就是问题所在吗?use DB
<?php
use Illuminate\Database\Seeder;
use Illuminate\Database\Eloquent\Model;
use DB;
class ClassesTableSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
DB::table('classes')->delete();
DB::table('classes')->insert([
'class_name' => 'Test course 111',
'class_id' => '1',
'location_name' => 'Barnes',
'location_id' => '1',
'date' => '2015-06-22',
'month' => '06/2015',
'start_time' => '08:00',
'end_time' => '16:00',
'places' => '19',
'places_left' => '19',
'price' => '155.00'
]);
}
}