41 lines
1.5 KiB
PHP
41 lines
1.5 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' => ['nullable', 'string', 'max:32', Rule::unique('dumpsites', 'code')->whereNull('deleted_at')],
|
|
'address_line' => ['required', 'string', 'max:255'],
|
|
'city_municipality_id' => ['required', 'integer', 'exists:cities_municipalities,id'],
|
|
'lat' => ['required', 'numeric', 'between:-90,90'],
|
|
'lng' => ['required', 'numeric', 'between:-180,180'],
|
|
'geofence_wkt' => ['nullable', 'string'],
|
|
'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,
|
|
])],
|
|
];
|
|
}
|
|
}
|