select * from `posts` left join `user_post_interactions` on `posts`.`id` = `user_post_interactions`.`post_id` where `posts`.`user_id` = 10 and not (`user_post_interactions`.`interaction_name` = 'hide' and `user_post_interactions`.`user_id` = 10)
我正在做的是:
$this->posts()->leftJoin('user_post_interactions', 'posts.id', '=', 'user_post_interactions.post_id')
->where(function($q) {
$q->where('user_post_interactions.interaction_name', '<>', 'hide')
->where('user_post_interactions.user_id', '<>', 10);
});
但这并没有产生我预期的结果。