我做了在基础文件名为数据库迁移class GridWithRoverSeeder在./database/seeds/GridWithRoverSeeder.php:
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
class GridWithRoverSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
DB::table('grid')->insert([
'id' => 1,
'width' => 10,
'height' => 10,
]);
DB::table('rover')->insert([
'id' => 1,
'rover_id' => 1,
'command' => "RRMRMMRM",
'last_command'=>""
]);
}
}
我从DatabaseSeeder以下位置调用它:
use Illuminate\Database\Seeder;
class DatabaseSeeder extends Seeder
{
/**
* Seed the application's database.
*
* @return void
*/
public function run()
{
$this->call([
GridWithRoverSeeder::class
]);
}
}
但是当我运行时php artisan db:seed出现以下错误:
ReflectionException : Class GridWithRoverSeeder does not exist
你知道为什么吗?
收到一只叮咚
慕码人8056858