Support the ongoing development of Laravel.io →
Database Eloquent

Good day, I'm new to laravel and have been attempting to figure out how on earth to do a multi-way relationship. I could be doing this completely wrong, so do bear with me.

So currently my db structure looks a little like this:

- Users
   -id
   -username

-Trades
  -id
  -user_id

-Trade_Items
  -id
  -trade_id
  -item_id

-Item_db
  -id
  -image etc

Now, what I am trying to achieve is to be able to access all of the information to that makes up a User's 'trade', i.e I get all the user's trades, find out the trade items and return the information from the item_db.

Each user can have many trades, each trade can have many items and those items from Trade_Items relate to one section of the Item_db.

So, what I currently have is an absolute mess, I can post it but I'm not sure it will help very much. If someone could at least point me in the right direction, I would be extremely grateful!

Last updated 3 years ago.
0

to solve this. draw an ER diagram. you will get there in no time.

0

astroanu said:

to solve this. draw an ER diagram. you will get there in no time.

Well, I don't believe it - this actually helped me solve the problem, thank you.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

donsta3000 donsta3000 Joined 11 Jul 2016

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.