id(); $estimate = $company->estimates()->whereCustomer($contact)->where('id', $id)->first(); if ($estimate === null) { return response()->json(['error' => 'estimate_not_found'], Response::HTTP_NOT_FOUND); } $verdict = $request->only('status'); $estimate->update($verdict); return EstimateResource::make($estimate); } }