From 71c90c8f49f84b02bcbb804f5c89a7ab99a71517 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20Miko=C5=82ajczak?= Date: Fri, 1 Jun 2018 19:05:12 +0200 Subject: [PATCH] Do not recommend myself MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marcin Mikołajczak --- app/Http/Controllers/DiscoverController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/DiscoverController.php b/app/Http/Controllers/DiscoverController.php index d7c70e30a..8a64c9379 100644 --- a/app/Http/Controllers/DiscoverController.php +++ b/app/Http/Controllers/DiscoverController.php @@ -16,8 +16,8 @@ class DiscoverController extends Controller public function home() { $following = Follower::whereProfileId(Auth::user()->profile->id)->pluck('following_id'); - $people = Profile::inRandomOrder()->whereNotIn('id', $following)->take(3)->get(); - $posts = Status::whereHas('media')->whereNotIn('profile_id', $following)->orderBy('created_at', 'desc')->take('21')->get(); + $people = Profile::inRandomOrder()->where('id', '!=', Auth::user()->profile->id)->whereNotIn('id', $following)->take(3)->get(); + $posts = Status::whereHas('media')->where('profile_id', '!=', Auth::user()->profile->id)->whereNotIn('profile_id', $following)->orderBy('created_at', 'desc')->take('21')->get(); return view('discover.home', compact('people', 'posts')); }