authorize('customerBelongsToService', $customer); $existingAnswerIds = $customer->getAnswers($service)->pluck('id'); $answersID = Answer::query()->whereIn('id', $request->answers)->pluck('id'); $customer->answers()->sync($answersID->merge($existingAnswerIds)); return response()->json(); } }