如何将mysql查询转换为laravel雄辩的orm

e5nqia27  于 2021-10-10  发布在  Java
关注(0)|答案(0)|浏览(127)

关闭。这个问题需要详细或明确。它目前不接受答案。
**想改进这个问题吗?**编辑这篇文章,添加细节并澄清问题。

9小时前关门。
改进这个问题
这是我的问题

SELECT *
              FROM posts  
              LEFT JOIN users ON posts.user_id=users.user_id  
              LEFT JOIN myorders ON (myorders.from_user_id=posts.user_id OR myorders.to_user_id=posts.user_id AND myorders.to_user_id=:user_id)
              LEFT JOIN friends ON (posts.user_id=friends.receiver OR posts.user_id=friends.sender AND posts.pageid='')
              LEFT JOIN pages ON posts.pageid=pages.pageid
              LEFT JOIN followers ON pages.pageid=followers.pageid AND followers.followerid=:user_id 
              WHERE posts.user_id=:user_id 
              OR (sender IN (SELECT receiver FROM friends WHERE sender=:user_id AND posts.privacy='Friends of Friends') AND receiver NOT IN (SELECT receiver FROM friends WHERE sender=:user_id AND posts.privacy='Friends of Friends'))
              OR (friends.receiver=:user_id AND friends.status='Yes' OR friends.sender=:user_id AND friends.status='Yes')
              OR posts.post_type='promsite' AND posts.advrfy='Verified' 
              OR posts.post_type='prompage' AND posts.advrfy='Verified' 
              OR posts.post_type='prompsvs' AND posts.advrfy='Verified' 
              OR posts.pgidposts=followers.pageid AND followers.followerid=:user_id

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题