public function relatedFeeds() { $commonFeeds = Feed::common()->orderBy('created_at'); $myFeeds = Feed::whereIn('project_id', $this->projects->lists('id'))->orderBy('created_at'); return $commonFeeds->get()->merge($myFeeds); }
/** * Get feeds posted by current user and friends via ajax. * * @param User $user * * @param int $startingPoint * * @return mixed */ public function getPublishedByUserAndFriendsAjax(User $user, $skipQty) { $friendsUserIds = $user->friends()->lists('requester_id'); $friendsUserIds[] = $user->id; return Feed::whereIn('user_id', $friendsUserIds)->latest()->skip($skipQty)->take(10)->get(); }