From 787064dc52e9a237855b2f422a96097ed68e53a9 Mon Sep 17 00:00:00 2001 From: Pim van Gennip Date: Fri, 23 Oct 2020 12:43:47 +0200 Subject: [PATCH] Bugfix #59 --- app/Http/Controllers/Api/InspectionsController.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/app/Http/Controllers/Api/InspectionsController.php b/app/Http/Controllers/Api/InspectionsController.php index cd384a7a..a3f9e0ca 100644 --- a/app/Http/Controllers/Api/InspectionsController.php +++ b/app/Http/Controllers/Api/InspectionsController.php @@ -258,15 +258,13 @@ public function store(Request $request) else if ($location) $inspection = $location->inspections()->orderBy('created_at','desc')->where('created_at', $date)->first(); else - $inspection = $user->inspections()->orderBy('created_at','desc')->where('created_at', $date)->first(); + return response()->json('no_owner_or_edit_rights', 400); + //$inspection = $user->inspections()->orderBy('created_at','desc')->where('created_at', $date)->first(); // filter -1 values for impression and attention $data['impression'] = $request->filled('impression') && $request->input('impression') > -1 ? $request->input('impression') : null; $data['attention'] = $request->filled('attention') && $request->input('attention') > -1 ? $request->input('attention') : null; - //die(print_r(['data'=>$data,'inspection'=>$inspection,'user'=>$user->inspections()->get()->toArray()])); - - if (isset($inspection)) $inspection->update($data); else @@ -283,7 +281,6 @@ public function store(Request $request) // Set inspection items - //die(print_r($request->input('items'))); // clear to remove items not in input $inspection->items()->forceDelete(); // add items in input