3 months ago

Laravel pivot multiple table condition

Posted 3 months ago by KarolGil


// I have tables:
post: id, body
comment: id, body
rate: id, name

// Intermediate tables:
post_comment: id, post_id, comment_id
post_rate: id, post_id, rate_id

How can I download posts with comments and ratings for which comment_id> 100 and rate_id in [1,2,3]? Which are taken from intermediate tables (post_comment, post_rate);

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