validated(); $player = Player::create([ 'name' => $data['player']['name'], 'phone' => $data['player']['phone'], 'email' => $data['player']['email'], 'club' => $data['player']['club'] ?? null, 'shirt_size' => $data['player']['shirt_size'] ?? null, ]); $registration = Registration::create([ 'event_id' => $event->id, 'player_id' => $player->id, 'type' => 'INDIVIDUAL', 'status' => 'PENDING_PAYMENT', 'handicap_type' => $data['handicap']['type'], 'handicap_value' => $data['handicap']['value'] ?? null, 'handicap_band' => $data['handicap']['band'], 'pairing_mode' => $data['preferences']['pairing_mode'], 'course_pref' => $data['preferences']['course_pref'], 'registration_code' => $codeService->make(), ]); return response()->json([ 'id' => $registration->id, 'registration_code' => $registration->registration_code, ], 201); } }