Selaa lähdekoodia

Update DiscoverController

Daniel Supernault 6 vuotta sitten
vanhempi
commit
0af5547dbb
1 muutettua tiedostoa jossa 8 lisäystä ja 0 poistoa
  1. 8 0
      app/Http/Controllers/DiscoverController.php

+ 8 - 0
app/Http/Controllers/DiscoverController.php

@@ -6,6 +6,7 @@ use App\Follower;
 use App\Hashtag;
 use App\Profile;
 use App\Status;
+use App\UserFilter;
 use Auth;
 use Illuminate\Http\Request;
 
@@ -23,6 +24,13 @@ class DiscoverController extends Controller
         $following = Follower::whereProfileId($pid)
           ->pluck('following_id');
 
+        $filtered = UserFilter::whereUserId($pid)
+                  ->whereFilterableType('App\Profile')
+                  ->whereIn('filter_type', ['mute', 'block'])
+                  ->pluck('filterable_id');
+                  
+        $following = $following->push($filtered);
+
         $people = Profile::inRandomOrder()
           ->where('id', '!=', $pid)
           ->whereNotIn('id', $following)