@karimali1337 laravel do not support pivots with 3 foreign keys, so, I always recommend to make separated model with 3 keys and not think aboput it as about pivot - this way you'll be able to eager load all related data
Oct 11, 2022
3
Level 2
Laravel Many to many in 3 tables
i've 3 tables Branches,Subjects,Teachers
Branches and subjects already many to many.
i've CRUD for teacher,when i create teacher i insert info to user model to add new user with type teacher.
i want to make relation to allow me combine teachers/branches/subjects.
for example when i'm creating teacher i need to select branch/branches and subject/subjects that this teacher related to.
any hint allows me to do this ?
Level 55
Please or to participate in this conversation.