Files
Verde-Web/app/Http/Requests/Geo/StoreServiceAreaRequest.php

31 lines
981 B
PHP

<?php
namespace App\Http\Requests\Geo;
use App\Models\ServiceArea;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
class StoreServiceAreaRequest 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('service_areas', 'code')->whereNull('deleted_at')],
'status' => ['nullable', Rule::in([ServiceArea::STATUS_ACTIVE, ServiceArea::STATUS_INACTIVE])],
'description' => ['nullable', 'string', 'max:1000'],
'barangay_ids' => ['nullable', 'array'],
'barangay_ids.*' => ['integer', 'exists:barangays,id'],
'boundary' => ['nullable', 'array'],
'boundary.*.lat' => ['required', 'numeric'],
'boundary.*.lng' => ['required', 'numeric'],
];
}
}