Jelajahi Sumber

Update discover controller

Daniel Supernault 6 tahun lalu
induk
melakukan
809423914f
1 mengubah file dengan 6 tambahan dan 1 penghapusan
  1. 6 1
      app/Http/Controllers/DiscoverController.php

+ 6 - 1
app/Http/Controllers/DiscoverController.php

@@ -19,8 +19,12 @@ class DiscoverController extends Controller
         $this->middleware('auth');
     }
 
-    public function home()
+    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, 15, function() use($pid) {
@@ -52,6 +56,7 @@ class DiscoverController extends Controller
           ->whereHas('profile', function($q) {
             $q->where('is_private', false);
           })
+          ->whereIsNsfw(false)
           ->whereVisibility('public')
           ->where('profile_id', '!=', $pid)
           ->whereNotIn('profile_id', $following)