dumpsites table with both coordinates POINT and boundary_polygon
POLYGON (SRID 4326). Admin CRUD accepts boundary as a list of {lat,lng}
points; ring is auto-closed. Dumpsite::containsPoint() runs ST_Contains
for geofence checks (Module 10 will fire arrived_at_dumpsite from this).
dumpsite_releases schema in place — trip_id stays nullable bigint until
Module 10 adds the FK.
109 feature tests passing.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
47 lines
1.9 KiB
PHP
47 lines
1.9 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Dumpsite;
|
|
|
|
use App\Models\Dumpsite;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Illuminate\Validation\Rule;
|
|
|
|
class UpdateDumpsiteRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public function rules(): array
|
|
{
|
|
$id = $this->route('dumpsite')?->id;
|
|
|
|
return [
|
|
'name' => ['sometimes', 'required', 'string', 'max:191'],
|
|
'code' => [
|
|
'sometimes', 'required', 'string', 'max:32',
|
|
Rule::unique('dumpsites', 'code')->whereNull('deleted_at')->ignore($id),
|
|
],
|
|
'address_line' => ['sometimes', 'required', 'string', 'max:255'],
|
|
'city_municipality_id' => ['sometimes', 'nullable', 'integer', 'exists:cities_municipalities,id'],
|
|
'lat' => ['sometimes', 'required_with:lng', 'numeric', 'between:-90,90'],
|
|
'lng' => ['sometimes', 'required_with:lat', 'numeric', 'between:-180,180'],
|
|
'boundary_polygon' => ['sometimes', 'nullable', 'array', 'min:3'],
|
|
'boundary_polygon.*.lat' => ['required_with:boundary_polygon', 'numeric', 'between:-90,90'],
|
|
'boundary_polygon.*.lng' => ['required_with:boundary_polygon', 'numeric', 'between:-180,180'],
|
|
'accepted_waste_types' => ['sometimes', 'nullable', 'array'],
|
|
'operating_hours' => ['sometimes', 'nullable', 'array'],
|
|
'capacity_tons' => ['sometimes', 'nullable', 'integer', 'min:0'],
|
|
'contact_person' => ['sometimes', 'nullable', 'string', 'max:191'],
|
|
'contact_phone' => ['sometimes', 'nullable', 'string', 'max:32'],
|
|
'permit_number' => ['sometimes', 'nullable', 'string', 'max:100'],
|
|
'status' => ['sometimes', Rule::in([
|
|
Dumpsite::STATUS_ACTIVE,
|
|
Dumpsite::STATUS_MAINTENANCE,
|
|
Dumpsite::STATUS_CLOSED,
|
|
])],
|
|
];
|
|
}
|
|
}
|