2018-04-16 01:56:17 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
|
|
|
|
use Illuminate\Http\Request;
|
2018-05-31 22:05:39 +00:00
|
|
|
use Auth;
|
|
|
|
use App\{Follower, Status, User};
|
2018-04-16 01:56:17 +00:00
|
|
|
|
|
|
|
class TimelineController extends Controller
|
|
|
|
{
|
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
$this->middleware('auth');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function personal()
|
|
|
|
{
|
2018-05-31 22:05:39 +00:00
|
|
|
// TODO: Use redis for timelines
|
|
|
|
$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);
|
2018-04-19 05:56:59 +00:00
|
|
|
return view('timeline.personal', compact('timeline'));
|
2018-04-16 01:56:17 +00:00
|
|
|
}
|
2018-05-31 22:05:39 +00:00
|
|
|
|
|
|
|
public function local()
|
|
|
|
{
|
|
|
|
// TODO: Use redis for timelines
|
|
|
|
$timeline = Status::whereHas('media')->whereNull('in_reply_to_id')->orderBy('id','desc')->simplePaginate(10);
|
|
|
|
return view('timeline.public', compact('timeline'));
|
|
|
|
}
|
|
|
|
|
2018-04-16 01:56:17 +00:00
|
|
|
}
|