forked from mirror/pixelfed
Update DiscoverController
This commit is contained in:
parent
e37108c544
commit
672ec191c6
1 changed files with 11 additions and 2 deletions
|
@ -3,13 +3,22 @@
|
|||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\{Hashtag, Status, StatusHashtag};
|
||||
use App\{Hashtag, Follower, Profile, Status, StatusHashtag};
|
||||
use Auth;
|
||||
|
||||
class DiscoverController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
}
|
||||
|
||||
public function home()
|
||||
{
|
||||
return view('discover.home');
|
||||
$following = Follower::whereProfileId(Auth::user()->profile->id)->pluck('following_id');
|
||||
$people = Profile::whereNotIn('id', $following)->orderByRaw('rand()')->take(3)->get();
|
||||
$posts = Status::whereHas('media')->whereNotIn('profile_id', $following)->orderBy('created_at', 'desc')->take('21')->get();
|
||||
return view('discover.home', compact('people', 'posts'));
|
||||
}
|
||||
|
||||
public function showTags(Request $request, $hashtag)
|
||||
|
|
Loading…
Reference in a new issue