/** * @param $postIds * @param User $actor * @return mixed */ protected function getDiscussionsForPosts($postIds, User $actor) { return Discussion::query()->select('discussions.*')->join('posts', 'posts.discussion_id', '=', 'discussions.id')->whereIn('posts.id', $postIds)->groupBy('discussions.id')->whereVisibleTo($actor)->get(); }
/** * Get a new query builder for the discussions table. * * @return Builder */ public function query() { return Discussion::query(); }