Explorar el Código

Update CollectionController, limit unpublished collections to owner

Daniel Supernault hace 3 años
padre
commit
a0061eb56c
Se han modificado 1 ficheros con 3 adiciones y 0 borrados
  1. 3 0
      app/Http/Controllers/CollectionController.php

+ 3 - 0
app/Http/Controllers/CollectionController.php

@@ -237,6 +237,9 @@ class CollectionController extends Controller
 
         return Collection::whereProfileId($profile->id)
         	->whereIn('visibility', $visibility)
+        	->when(!$owner, function($q, $owner) {
+        		return $q->whereNotNull('published_at');
+        	})
             ->orderByDesc('id')
             ->paginate(9)
             ->map(function($collection) {