From 8374ebf0f846c25c19b4f31677aad234a1452510 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Thu, 8 Nov 2018 21:14:35 -0700 Subject: [PATCH] Update DiscoverController --- app/Http/Controllers/DiscoverController.php | 48 +-------------------- 1 file changed, 1 insertion(+), 47 deletions(-) diff --git a/app/Http/Controllers/DiscoverController.php b/app/Http/Controllers/DiscoverController.php index f4b0097ca..7aca896d4 100644 --- a/app/Http/Controllers/DiscoverController.php +++ b/app/Http/Controllers/DiscoverController.php @@ -21,53 +21,7 @@ class DiscoverController extends Controller public function home(Request $request) { - $this->validate($request, [ - 'page' => 'nullable|integer|max:50' - ]); - - $pid = Auth::user()->profile->id; - - $following = Cache::remember('feature:discover:following:'.$pid, 720, function() use($pid) { - $following = Follower::select('following_id') - ->whereProfileId($pid) - ->pluck('following_id'); - $filtered = UserFilter::select('filterable_id') - ->whereUserId($pid) - ->whereFilterableType('App\Profile') - ->whereIn('filter_type', ['mute', 'block']) - ->pluck('filterable_id'); - $following->push($pid); - - if($filtered->count() > 0) { - $following->push($filtered); - } - return $following; - }); - - $people = Cache::remember('feature:discover:people:'.$pid, 15, function() use($following) { - return Profile::select('id', 'name', 'username')->inRandomOrder() - ->whereHas('statuses') - ->whereNull('domain') - ->whereNotIn('id', $following) - ->whereIsPrivate(false) - ->take(3) - ->get(); - }); - - $posts = Status::select('id', 'caption', 'profile_id') - ->whereHas('media') - ->whereHas('profile', function($q) { - $q->where('is_private', false); - }) - ->whereIsNsfw(false) - ->whereVisibility('public') - ->where('profile_id', '<>', $pid) - ->whereNotIn('profile_id', $following) - ->withCount(['comments', 'likes']) - ->orderBy('created_at', 'desc') - ->simplePaginate(21); - - return view('discover.home', compact('people', 'posts')); + return view('discover.home'); } public function showTags(Request $request, $hashtag)