Laravel package to let you manage de-normalized tables with simple configurations. Just add array based config in your models and it will automatically sync your denormalized tables. https://github.com/tkeer/flattable
Here a user has a location with many to many positions. This query finds users having position id 4 and location id 6. the tables are users, profile, locations. and profile has location_id.
The main difference is which side of the relationship holds the relationship's foreign key. The model that calls $this->belongsTo() is the owned model in one-to-one and many-to-one relationships and holds the key to the owning model.
Here posts and categories have many to many relationships. the tricks are to fetch posts having a particular category attribute with categories details.
if you want to use ORM eloquent to get a query with the third table and select only particular attributes then here is the trick.
Here users can have multiple positions in a company and each user has their own user profile.
*note that user_id must be here to fetch data with a specific column. without foreign key eloquent cannot map relational table