4 months ago

How do I create a custom relationship model?

Posted 4 months ago by jasonrudland

I am struggling to create a custom relationship model to implement a BelongsToManyThrough relationship.

I have a property model which has a many-to-many relationship with my room-types model, which in turn has a many-to-many relationship with my amenities model.

I need to access amenities via the room types associated with a property.

After much trial, error & research I discovered Alex Weissman's BelongsToManyThrough custom relationship which would seem to be a solution. However, I can't find out how to actually create a custom relationship. Where do I put the files? Is there and Artisan command?

Any help would be greatly appreciated.

Please sign in or create an account to participate in this conversation.