[英]Laravel: Using One pivot table id in another pivot table
I'm working in a Laravel 7 project.我在 Laravel 7 项目中工作。 I've implemented my table structure as below:
我已经实现了我的表结构如下:
Programs and Sections many-to-many多对多的程序和部分
program_id
section_id
sections
name
program_section
program_id section_id
Teachers and Subjects many-to-many教师和科目多对多
name email designation
subjects
name
subject_teacher
subject_id teacher_id
Now, what i want is to use the program_section
(pivot) id
inside subject_teacher
pivot table, so that i can insert the program_section_id
in subject_teacher
table and get the program/section of specific teacher/subject.现在,我想要的是在
subject_teacher
数据透视表中使用program_section
(pivot) id
,以便我可以在subject_teacher
表中插入program_section_id
并获取特定教师/科目的程序/部分。
Any idea how to do this using Laravel Eloquent
?知道如何使用
Laravel Eloquent
做到这Laravel Eloquent
吗?
您可以在 Laravel 上使用多对多关系,请尝试阅读此内容
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.