表:项目在此处输入图像描述
表:项目\此处为部门图像描述表:此处为部门图像描述
这是样板工程
public function projects_departments() {
return $this->hasMany(Project_department::class);
}
这是模型项目部
public function projects()
{
return $this->belongsTo(Project::class);
}
public function departments()
{
return $this->belongsTo(Department::class);
}
这是模特部
public function projects()
{
return $this->hasMany(Project::class);
}
public function projects_departments() {
return $this->hasMany(Project_department::class);
}
这是我的刀
project->departments->department_name
这是我的错误sqlstate[42s22]:找不到列:“where子句”中的1054未知列“projects\u departments.project\u id”(sql:select*from) projects_departments
哪里 projects_departments
. project_id
=48和 projects_departments
. project_id
(不为空)
1条答案
按热度按时间kqqjbcuj1#
让我们试试这个