From 0cfc12c5ddc6dcce1a7ead2f7b6846ef6b987b4f Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sun, 17 Jan 2021 21:38:34 -0700 Subject: [PATCH] Update StatusController, add view method --- app/Http/Controllers/StatusController.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/app/Http/Controllers/StatusController.php b/app/Http/Controllers/StatusController.php index 06424bb9b..041268c05 100644 --- a/app/Http/Controllers/StatusController.php +++ b/app/Http/Controllers/StatusController.php @@ -408,4 +408,25 @@ class StatusController extends Controller return response()->json([200]); } + + public function storeView(Request $request) + { + abort_if(!$request->user(), 403); + + $this->validate($request, [ + 'status_id' => 'required|integer|exists:statuses,id', + 'profile_id' => 'required|integer|exists:profiles,id' + ]); + + $sid = (int) $request->input('status_id'); + $pid = (int) $request->input('profile_id'); + + StatusView::firstOrCreate([ + 'status_id' => $sid, + 'status_profile_id' => $pid, + 'profile_id' => $request->user()->profile_id + ]); + + return response()->json(1); + } }