Files
Verde-Web/app/Http/Requests/Dumpsite/StoreDumpsiteRequest.php
admin 474b1cfe0b feat(backend): complete Module 6 (dumpsites + geofence)
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>
2026-04-30 00:39:14 +08:00

43 lines
1.7 KiB
PHP

<?php
namespace App\Http\Requests\Dumpsite;
use App\Models\Dumpsite;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
class StoreDumpsiteRequest 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('dumpsites', 'code')->whereNull('deleted_at')],
'address_line' => ['required', 'string', 'max:255'],
'city_municipality_id' => ['nullable', 'integer', 'exists:cities_municipalities,id'],
'lat' => ['required', 'numeric', 'between:-90,90'],
'lng' => ['required', 'numeric', 'between:-180,180'],
'boundary_polygon' => ['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' => ['nullable', 'array'],
'accepted_waste_types.*' => ['string', 'max:50'],
'operating_hours' => ['nullable', 'array'],
'capacity_tons' => ['nullable', 'integer', 'min:0'],
'contact_person' => ['nullable', 'string', 'max:191'],
'contact_phone' => ['nullable', 'string', 'max:32'],
'permit_number' => ['nullable', 'string', 'max:100'],
'status' => ['nullable', Rule::in([
Dumpsite::STATUS_ACTIVE,
Dumpsite::STATUS_MAINTENANCE,
Dumpsite::STATUS_CLOSED,
])],
];
}
}