From fccc353aaa8b0f1acef7530455c7bf4af344657f Mon Sep 17 00:00:00 2001 From: Kekskurse Date: Tue, 19 Jan 2021 23:32:50 +0100 Subject: [PATCH] Stuff --- app/Http/Controllers/PublicController.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/PublicController.php b/app/Http/Controllers/PublicController.php index ebdebf3..528af09 100644 --- a/app/Http/Controllers/PublicController.php +++ b/app/Http/Controllers/PublicController.php @@ -14,6 +14,7 @@ use Illuminate\Foundation\Auth\Access\AuthorizesRequests; use Illuminate\Foundation\Bus\DispatchesJobs; use Illuminate\Foundation\Validation\ValidatesRequests; use Illuminate\Routing\Controller as BaseController; +use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Storage; use phpDocumentor\Reflection\Types\Integer; @@ -44,7 +45,12 @@ class PublicController extends BaseController public function listGalleryImagesView($tenant, $gallery) { $tenant = Tenant::query()->where("url", "=", $tenant)->firstOrFail(); $gallery = Gallery::getByTenantAndUrl($tenant->id, $gallery); - $images = Image::query()->where("gallery", "=", $gallery->id)->whereNull("deleted_at")->get(); + if($gallery->status == "online" || ($gallery->status == "preview" && Auth::user()->id == $tenant->owner)) { + $images = Image::query()->where("gallery", "=", $gallery->id)->whereNull("deleted_at")->get(); + } else { + abort( 404); + } + return view("themes.gallery.gallery-detail.list", ["gallery" => $gallery, "tenant" => $tenant, "images" => $images]); }