Skip to content

Commit

Permalink
Bugfix beepnl#59
Browse files Browse the repository at this point in the history
  • Loading branch information
pvgennip committed Oct 23, 2020
1 parent 34fb80d commit 787064d
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions app/Http/Controllers/Api/InspectionsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 787064d

Please sign in to comment.