From ae24433b8c4816f3ba692d5a698425b2690bbf18 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Wed, 29 Jan 2020 22:03:34 -0700 Subject: [PATCH] Update StatusController, restrict edits to 24 hours --- app/Http/Controllers/StatusController.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/StatusController.php b/app/Http/Controllers/StatusController.php index a5e9e09d..ef1d5939 100644 --- a/app/Http/Controllers/StatusController.php +++ b/app/Http/Controllers/StatusController.php @@ -229,8 +229,8 @@ class StatusController extends Controller $user = Auth::user()->profile; $status = Status::whereProfileId($user->id) ->with(['media']) + ->where('created_at', '>', now()->subHours(24)) ->findOrFail($id); - return view('status.edit', compact('user', 'status')); } @@ -240,6 +240,7 @@ class StatusController extends Controller $user = Auth::user()->profile; $status = Status::whereProfileId($user->id) ->with(['media']) + ->where('created_at', '>', now()->subHours(24)) ->findOrFail($id); $this->validate($request, [ @@ -254,7 +255,7 @@ class StatusController extends Controller $media = Media::whereProfileId($user->id) ->whereStatusId($status->id) - ->find($id); + ->findOrFail($id); $changed = false; @@ -263,7 +264,7 @@ class StatusController extends Controller $changed = true; } - if ($media->filter_class != $filter) { + if ($media->filter_class != $filter && in_array($filter, Filter::classes())) { $media->filter_class = $filter; $changed = true; }