Level 23
you can make a model from it and give the model this table
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I have a these models; Child, Toy, Brand
Child M:N Toy, Toy M:N Brand
Here are my pivot tables;
child_toy_pivot | toy_brand_pivot
------------------------------------------------
id | toy_id
child_id | brand_id
toy_id |
Before giving the child a toy, the system must check if the child already owns that toy that has the same brand. So rather than making a pivot table with 3 foreign keys in it, I just made another pivot table
unnamed_pivot |
--------------------|
child_toy_id |
brand_id |
I would like to know how could I apply this in eloquent? How could I create a new record in it?
Please or to participate in this conversation.