user(); $person = $this->registrationService->register( $event, $request->validated(), $user ); $person->load('crowdType'); $hasExistingAccount = PersonIdentityMatch::where('person_id', $person->id) ->where('status', IdentityMatchStatus::PENDING) ->exists(); $responseData = [ 'person' => new PersonResource($person), 'has_existing_account' => $hasExistingAccount, ]; if ($person->wasRecentlyCreated) { return $this->created($responseData); } return $this->success($responseData); } }