我有两个相关的表,我想返回所有字段,包括 ID(键)字段。我下面的查询返回除 ID 之外的所有字段。如何从其中一个表中返回 ID 字段?
'programmes' => ProgrammeInstances::with('programmes')->get(),
下面的查询返回未知列“programmes.programme_title”,因为它正在表“programme_instances”中寻找它
'programmes' => ProgrammeInstances::with('programmes')->select('programmes.programme_title','programmeInstances.id','programmeInstances.name','programmeInstances.year')->get(),