drop_off_points (with SPATIAL INDEX on coordinates) +
drop_off_capacity_logs. Public nearby query via ST_Distance_Sphere
returns DOPs sorted by distance with distance_meters in payload.
Admin CRUD plus capacity-log endpoint. Household creation auto-assigns
to the nearest active DOP within 25km; resident can re-run the lookup
via POST /households/{uuid}/reassign-drop-off.
97 feature tests passing.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
24 lines
651 B
PHP
24 lines
651 B
PHP
<?php
|
|
|
|
namespace App\Http\Resources;
|
|
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
class DropOffCapacityLogResource extends JsonResource
|
|
{
|
|
public function toArray(Request $request): array
|
|
{
|
|
return [
|
|
'id' => $this->id,
|
|
'recorded_at' => $this->recorded_at?->toIso8601String(),
|
|
'fill_percent' => $this->fill_percent,
|
|
'notes' => $this->notes,
|
|
'recorded_by' => $this->whenLoaded('recordedBy', fn () => [
|
|
'id' => $this->recordedBy?->uuid,
|
|
'name' => $this->recordedBy?->full_name,
|
|
]),
|
|
];
|
|
}
|
|
}
|