Basically, if the user is logged in (Auth::check()), statuses are loaded where the status' user id matches the current user, or where the status' user id is that of one of the current user's friends. Ordered with newest first. Those are then passed to the timeline view.
If the user is not logged in, the 'home' view is displayed.
$statuses = Status::where(function($query) {
return $query->where('user_id', Auth::user()->id)
->orWhereIn('user_id', Auth::user()->friends()->lists('id'));
})
->orderBy('created_at', 'desc')
->get();
translates to, essentially, this query:
SELECT * FROM statuses WHERE user_id = 1 OR user_id IN (2, 3, 4, 5, 6) ORDER BY created_at DESC
Assuming the current user's ID is 1, and their friends user ids are 2-6.