validate([ 'entity_type' => 'required|in:lead,company', 'exclude_id' => 'nullable|integer', 'name' => 'nullable|string', 'company' => 'nullable|string', 'website' => 'nullable|string', 'email' => 'nullable|string', 'phone' => 'nullable|string', ]); $items = $validated['entity_type'] === 'company' ? $this->duplicates->companySuggestions($validated, $validated['exclude_id'] ?? null, auth()->user()) : $this->duplicates->leadSuggestions($validated, $validated['exclude_id'] ?? null, auth()->user()); return response()->json(['data' => $items]); } }