From 8e033b3228fbab9324cf3b5e3e98b8e7596ac13e Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Thu, 1 Aug 2019 22:34:39 -0600 Subject: [PATCH] Update CollectionController --- app/Http/Controllers/CollectionController.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/CollectionController.php b/app/Http/Controllers/CollectionController.php index 88406475..c2c62350 100644 --- a/app/Http/Controllers/CollectionController.php +++ b/app/Http/Controllers/CollectionController.php @@ -34,7 +34,7 @@ class CollectionController extends Controller public function show(Request $request, int $collection) { - $collection = Collection::whereNotNull('published_at')->findOrFail($collection); + $collection = Collection::with('profile')->whereNotNull('published_at')->findOrFail($collection); if($collection->profile->status != null) { abort(404); } @@ -100,7 +100,11 @@ class CollectionController extends Controller $collection->items()->delete(); $collection->delete(); - return 200; + if($request->wantsJson()) { + return 200; + } + + return redirect('/'); } public function storeId(Request $request)