I'm working in a Laravel 7 project. I've implemented my table structure as below:
Programs and Sections many-to-many
progarmsprogram_id
section_id
sections
name
program_section
program_id section_id
Teachers and Subjects many-to-many
teachersname 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.
Any idea how to do this using Laravel Eloquent
?
您可以在 Laravel 上使用多对多关系,请尝试阅读此内容
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.