CourseController::quizResults().{quiz} is route-model-bound to App\Models\CourseLog\Quiz by its primary key. Ownership is checked inline against both {log_code} and the authenticated user, not via a policy: $quiz->log_code !== $log_code || $quiz->user_id !== auth()->id() returns 403.App\Http\Controllers\Api\V1\Diver\CourseController::quizResults()api.v1.diver.courses.quiz.resultsAuthorization: Bearer {token}GET/api/v1/diver/courses/{log_code}/quiz/{quiz}| Parameter | Type | Description |
|---|---|---|
{log_code} | string(32) | Opaque course log code |
{quiz} | integer | Quiz attempt id, route-model-bound |
200 OK_resources.md → "Quiz result".{
"success": true,
"status": "success",
"message": "OK",
"data": {
"id": 61222,
"log_code": "6fc53117a24f6bbc76fa8f4bbcaa02dd",
"module_id": 223,
"total": 10,
"correct": 10,
"wrong": 0,
"score": 100,
"passed": true,
"date": "2014-11-11",
"start": "2014-11-11 05:54:36",
"end": "2014-11-11 06:04:19",
"questions": [
{
"id": 319,
"text": "Who discovered Buoyancy?",
"missing": false,
"answers": [
{ "id": 1261, "text": "Boyle", "is_correct": false, "selected": false },
{ "id": 1263, "text": "Archimedes", "is_correct": true, "selected": true }
]
}
]
}
}_resources.md → "Quiz result".401 Unauthorized{
"success": false,
"status": "error",
"message": "Unauthenticated"
}403 Forbidden{quiz} exists but does not belong to {log_code} or to the authenticated user. Not a 404 — the route-model binding succeeds, ownership is checked afterward.{
"success": false,
"status": "error",
"message": "Forbidden"
}404 Not Found{quiz} does not exist at all — not the standard envelope.{
"message": "No query results for model [App\\Models\\CourseLog\\Quiz] 999999999"
}is_correct flag regardless of what the diver selected — this response is not safe to show before a diver has completed the attempt.docs/api/diver/courses/GET_quiz_results.mdcurl --location 'https://test.diveraid.com/api/v1/diver/courses//quiz/' \
--header 'Authorization: Bearer <token>'{
"status": "success",
"message": "string",
"data": {
"id": 0,
"log_code": "string",
"module_id": 0,
"total": 0,
"correct": 0,
"wrong": 0,
"score": 0,
"passed": true,
"date": "2019-08-24",
"start": "2019-08-24T14:15:22.123Z",
"end": "2019-08-24T14:15:22.123Z",
"questions": [
{
"id": 0,
"text": "string",
"missing": true,
"answers": [
{
"id": 0,
"text": "string",
"is_correct": true,
"selected": true
}
]
}
]
}
}