DiveLogController::update(). Every field is optional (sometimes) — only submitted keys are changed.{diveLog} is route-model-bound by primary key. Ownership and lock state are both checked in UpdateDiveLogRequest::authorize(), not in the controller, through DiveLogPolicy::updateOwn() — the only endpoint in this group that refuses this way rather than inside the controller body (contrast GET_show.md and DELETE_destroy.md). A signed dive log (is_signed = true) cannot be updated by anyone, including its owner, and no role (administrator included) bypasses the ownership check.App\Http\Controllers\Api\V1\Diver\DiveLogController::update()api.v1.diver.dive-logs.updateAuthorization: Bearer {token}PATCH/api/v1/diver/dive-logs/{diveLog}application/json| Parameter | Type | Description |
|---|---|---|
{diveLog} | integer | Dive log primary key, route-model-bound |
{
"end": 10,
"cylinder_count": 2,
"bottom_cylinder_volume": 12
}sometimes — same field set as POST_create.md (minus dive_number, is_free_diving, purpose_type and the course_log fields, none of which are updatable), each independently optional:| Field | Type | Validation |
|---|---|---|
date | string | sometimes|string|date — format "YYYY-MM-DD HH:MM:SS"; an impossible calendar date or time (2026-02-30, 2026-13-01, 25:00) is rejected with 422 |
location, country | string | sometimes|string |
lat, lon | number, nullable | nullable|numeric|between:-90,90|required_with:lon for lat, nullable|numeric|between:-180,180|required_with:lat for lon. Optional; when sent, send both, or both null to clear |
dive_type, gas | string | sometimes|string|enum — values in POST_create.md → "Enum values" |
dive_config | string | sometimes|string|enum — values in POST_create.md → "Enum values". Cannot cross the freediving boundary (freediving ↔ any other value): 422 on dive_config. Delete the log and create a new one |
weather, water, current, visibility | string, nullable | sometimes|nullable|string|enum — values in POST_create.md → "Enum values" |
dive_condition_notes, wetsuit, buddy, verified_by, comments, decompression_note | string, nullable | sometimes|string|nullable |
group_in, group_out | string, nullable | sometimes|nullable|string, one of A to Z |
weights | number, nullable | sometimes|numeric|nullable|min:0|max:100 |
water_temperature | number, nullable | sometimes|numeric|nullable|min:-4|max:100 |
weather_temperature | number, nullable | sometimes|numeric|nullable|min:-50|max:130 |
dive_time | integer | sometimes|integer|min:5 |
max_depth | number | sometimes|numeric|min:1|max:660 |
average_depth | number | sometimes|numeric|min:1 plus the bound by max_depth — see below |
sac_rate | number, nullable | sometimes|numeric|nullable |
pressure_start | number, nullable | sometimes|nullable|numeric |
pressure_end | number, nullable | sometimes|nullable|numeric plus the bound by pressure_start — see below |
gas_mix | object | sometimes|required|array:oxygen,nitrogen,helium (an empty {} is rejected); gas_mix.oxygen and gas_mix.nitrogen are required_with:gas_mix|numeric|min:0|max:100, gas_mix.helium is sometimes|numeric|min:0|max:100 |
safety_stop, has_decompression | boolean, nullable | sometimes|boolean|nullable |
abt | integer | sometimes|integer|min:0 plus the bound by dive_time — see below |
rnt | integer | sometimes|integer|min:0|max:300 |
tbt | integer | sometimes|integer|min:0 |
tts | integer, nullable | sometimes|integer|nullable|min:0 plus the bound by dive_time — see below |
mod | integer, nullable | sometimes|integer|nullable|min:0 — no cross-check against max_depth |
end | integer, nullable | sometimes|integer|nullable|min:0 plus the bound by max_depth — see below |
cylinder_count | integer, nullable | sometimes|nullable|integer |
bottom_cylinder_volume | number, nullable | sometimes|nullable|numeric |
abt and tts must not exceed dive_time, end and average_depth must not exceed max_depth, and pressure_end must not exceed pressure_start. A partial update does not have to send both fields:lte:);pressure_start is null on most dive logs), no bound applies.gas_mix is replaced as a whole when it is sent, and is always sent and returned as {oxygen, nitrogen, helium} (see POST_create.md).App\Http\Requests\Api\V1\Diver\UpdateDiveLogRequest, extends ApiFormRequest — full envelope 422. When country is submitted, region/subregion are recomputed server-side; an invalid code is silently dropped from the update rather than rejected (unset($validated['country']) inside a catch) — the rest of the update still proceeds.200 OK{
"success": true,
"status": "success",
"message": "Dive log updated successfully",
"data": {
"id": 671996,
"uuid": "5d02c670-1eaa-4b38-9b84-65fa611be6e1",
"number": 403,
"date": "2026-09-17 09:30:00",
"dive_type": "boat",
"purpose_type": "fun_dive",
"location": "Example Reef",
"country": "IT",
"lat": null,
"lon": null,
"dive_config": "open_circuit",
"gas": "nitrox",
"gas_mix": { "helium": 0, "nitrogen": 68, "oxygen": 32 },
"max_depth": 18,
"average_depth": 10,
"depth_unit": "meters",
"dive_time": 40,
"abt": 35,
"rnt": 0,
"tbt": 35,
"tts": 0,
"pressure_start": null,
"pressure_end": null,
"pressure_unit": "bar",
"water_temperature": null,
"weather_temperature": null,
"temperature_unit": "celsius",
"weather": null,
"water": null,
"current": null,
"visibility": null,
"weights": null,
"weights_unit": "kilogram",
"buddy": null,
"verified_by": null,
"wetsuit": null,
"sac_rate": null,
"safety_stop": false,
"has_decompression": false,
"decompression_note": null,
"mod": 40,
"end": 10,
"group_in": "C",
"group_out": null,
"comments": null,
"log_code": null,
"course_id": null,
"skill_log_id": null,
"skill_id": null,
"instructor_id": null,
"is_signed": false,
"signed_at": null,
"cylinder_count": 2,
"bottom_cylinder_volume": 12,
"dive_condition_notes": null
}
}DiveLogResource shape — see _resources.md → "Dive log". The order of the keys inside gas_mix is not significant.401 Unauthorized{
"success": false,
"status": "error",
"message": "Unauthenticated"
}403 Forbidden — not the owner, or the dive log is signedFormRequest::authorize() failure, not the app's own error shape — no success/status keys, unlike every inline forbidden() call elsewhere in this area (compare GET_show.md's 403).{
"message": "This action is unauthorized."
}is_signed = true) — a client cannot distinguish the two cases from the response alone. This is by design: authorize() answers with a single boolean from DiveLogPolicy::updateOwn(), and the body is Laravel's default for it.404 Not FoundDELETE_destroy.md):{
"message": "No query results for model [App\\Models\\Users\\DiveLog] 999999999"
}422 Unprocessable Entity — validationmax_depth: 5 with average_depth: 10 in the same request.{
"success": false,
"status": "error",
"message": "Validation failed",
"errors": {
"average_depth": ["The average depth field must be less than or equal to 5."]
}
}422 Unprocessable Entity — bound by the stored valueabt: 41 sent alone, on a dive log whose stored dive_time is 40.{
"success": false,
"status": "error",
"message": "Validation failed",
"errors": {
"abt": ["The abt field must not be greater than 40."]
}
}A-Z is a 422 on that field in the same shape as in POST_create.md.DiveLog row, then calls DiveLog::reorder($user) — same reorder as creation, even though number is not itself editable here.number, uuid, log_code, course_id, skill_log_id, skill_id, instructor_id, is_signed, signed_at are not in the validated field set and cannot be changed through this endpoint.null by the application's global input middleware before validation, so a text field sent as " " arrives as null.dive_config cannot cross the freediving boundary, in either direction, because that would need the gas, mix and times rewritten. The response is a 422 on dive_config with the message A dive log cannot be switched between freediving and another configuration. Delete it and create a new one. Changes inside the same family (for example open_circuit to sidemount_oc) are accepted.docs/api/diver/dive-logs/PATCH_update.mdcurl --location --request PATCH 'https://test.diveraid.com/api/v1/diver/dive-logs/' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"date": "2019-08-24",
"location": "string",
"max_depth": 0,
"dive_time": 0,
"comments": "string",
"dive_config": "freediving",
"dive_type": "pool",
"weather": "sunny",
"water": "calm",
"current": "no_current",
"visibility": "poor",
"gas": "air",
"gas_mix": {
"oxygen": 0,
"nitrogen": 0,
"helium": 0
},
"group_in": "string",
"group_out": "string",
"lat": -90,
"lon": -180
}'{
"status": "success",
"message": "string",
"data": {
"id": 0,
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
"number": 0,
"date": "2019-08-24",
"dive_type": "string",
"purpose_type": "string",
"location": "string",
"country": "string",
"lat": 0,
"lon": 0,
"dive_config": "string",
"gas": "string",
"gas_mix": {
"oxygen": 0,
"nitrogen": 0,
"helium": 0
},
"max_depth": 0,
"average_depth": 0,
"depth_unit": "string",
"dive_time": 0,
"abt": 0,
"rnt": 0,
"tbt": 0,
"tts": 0,
"pressure_start": 0,
"pressure_end": 0,
"pressure_unit": "string",
"water_temperature": 0,
"weather_temperature": 0,
"temperature_unit": "string",
"weather": "string",
"water": "string",
"current": "string",
"visibility": "string",
"weights": 0,
"weights_unit": "string",
"buddy": "string",
"verified_by": "string",
"wetsuit": "string",
"sac_rate": 0,
"safety_stop": true,
"has_decompression": true,
"decompression_note": "string",
"mod": 0,
"end": "2019-08-24T14:15:22.123Z",
"group_in": "string",
"group_out": "string",
"comments": "string",
"log_code": "string",
"course_id": 0,
"skill_log_id": 0,
"skill_id": 0,
"instructor_id": 0,
"is_signed": true,
"signed_at": "2019-08-24T14:15:22.123Z",
"cylinder_count": 0,
"bottom_cylinder_volume": 0,
"dive_condition_notes": "string"
}
}