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>
40 lines
1.4 KiB
PHP
40 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests\DropOff;
|
|
|
|
use App\Models\DropOffPoint;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Illuminate\Validation\Rule;
|
|
|
|
class StoreDropOffPointRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'name' => ['required', 'string', 'max:191'],
|
|
'code' => ['required', 'string', 'max:32', Rule::unique('drop_off_points', 'code')->whereNull('deleted_at')],
|
|
'barangay_id' => ['nullable', 'integer', 'exists:barangays,id'],
|
|
'lat' => ['required', 'numeric', 'between:-90,90'],
|
|
'lng' => ['required', 'numeric', 'between:-180,180'],
|
|
'address_line' => ['required', 'string', 'max:255'],
|
|
'capacity_kg' => ['nullable', 'integer', 'min:0'],
|
|
'operating_hours' => ['nullable', 'array'],
|
|
'accepted_waste_types' => ['nullable', 'array'],
|
|
'accepted_waste_types.*' => ['string', 'max:50'],
|
|
'status' => ['nullable', Rule::in([
|
|
DropOffPoint::STATUS_ACTIVE,
|
|
DropOffPoint::STATUS_MAINTENANCE,
|
|
DropOffPoint::STATUS_CLOSED,
|
|
])],
|
|
'photo_path' => ['nullable', 'string', 'max:255'],
|
|
'contact_person' => ['nullable', 'string', 'max:191'],
|
|
'contact_phone' => ['nullable', 'string', 'max:32'],
|
|
];
|
|
}
|
|
}
|