all(), [ 'badge_scan' => ['required', 'string', 'max:255'], 'school_year' => ['nullable', 'string', 'max:50'], 'semester' => ['nullable', 'string', 'max:50'], ]); if ($validator->fails()) { return $this->respondValidationError($validator->errors()->toArray()); } $payload = $validator->validated(); $context = $this->schoolYears->options($payload['school_year'] ?? null, $payload['semester'] ?? null); $result = $this->badgeScan->processScan( $payload['badge_scan'], $context['school_year'] ?? null, $context['semester'] ?? null ); if (! $result['recognized']) { return $this->error($result['message'], Response::HTTP_NOT_FOUND); } return $this->success([ 'recognized' => true, 'user_id' => $result['user_id'] ?? null, 'display_name' => $result['display_name'] ?? null, ], $result['message']); } /** * Authenticated scan log listing (legacy RFIDController::log). */ public function logs(Request $request): JsonResponse { $context = $this->schoolYears->options( $request->query('school_year'), $request->query('semester') ); return $this->success([ 'logs' => $this->badgeScan->scanLogRows( $context['school_year'] ?? null, $context['semester'] ?? null ), 'meta' => $context, ]); } }