Update TimelineController

This commit is contained in:
Daniel Supernault 2018-06-03 19:40:19 -06:00
parent 31f7957d30
commit b4394605ee

View file

@ -17,14 +17,23 @@ class TimelineController extends Controller
{ {
// TODO: Use redis for timelines // TODO: Use redis for timelines
$following = Follower::whereProfileId(Auth::user()->profile->id)->pluck('following_id'); $following = Follower::whereProfileId(Auth::user()->profile->id)->pluck('following_id');
$timeline = Status::whereHas('media')->whereNull('in_reply_to_id')->whereIn('profile_id', $following)->orderBy('id','desc')->simplePaginate(10); $timeline = Status::whereHas('media')
->whereNull('in_reply_to_id')
->whereIn('profile_id', $following)
->orderBy('id','desc')
->withCount(['comments', 'likes'])
->simplePaginate(10);
return view('timeline.personal', compact('timeline')); return view('timeline.personal', compact('timeline'));
} }
public function local() public function local()
{ {
// TODO: Use redis for timelines // TODO: Use redis for timelines
$timeline = Status::whereHas('media')->whereNull('in_reply_to_id')->orderBy('id','desc')->simplePaginate(10); $timeline = Status::whereHas('media')
->whereNull('in_reply_to_id')
->orderBy('id','desc')
->withCount(['comments', 'likes'])
->simplePaginate(10);
return view('timeline.public', compact('timeline')); return view('timeline.public', compact('timeline'));
} }