【发布时间】:2021-07-19 10:57:31
【问题描述】:
我有 StudentEducation 模型,在这个模型中我得到了
public function student_education_countries()
{
return $this->hasMany(StudentEducationCountry::class, 'education_id');
}
和
public function student_education_education_types()
{
return $this->hasMany(StudentEducationEducationType::class, 'education_id');
}
在 StudentEducationCountry 模型中我得到了
public function student_education()
{
return $this->belongsTo(StudentEducation::class, 'education_id');
}
public function student_country()
{
return $this->belongsTo(StudentCountry::class, 'country_id');
}
在 StudentEducationEducationType 模型中我得到了
public function student_education()
{
return $this->belongsTo(StudentEducation::class, 'education_id');
}
public function student_educationcategory()
{
return $this->belongsTo(StudentEducationcategory::class, 'educationcategory_id');
}
问题是我应该如何加入以参加 country_id 为 2 且类型为次要的所有教育
【问题讨论】:
标签: laravel join collections