29 lines
969 B
PHP
29 lines
969 B
PHP
<?php
|
|
|
|
namespace App\Http\Requests\SuperAdmin;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class StoreBarangayRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'name' => ['required', 'string', 'max:191'],
|
|
'city_municipality_id' => ['required', 'integer', 'exists:cities_municipalities,id'],
|
|
'psgc_code' => ['nullable', 'string', 'max:12', 'unique:barangays,psgc_code'],
|
|
'code' => ['nullable', 'string', 'max:16', 'unique:barangays,code'],
|
|
'urban_rural' => ['required', 'string', 'in:urban,rural,unknown'],
|
|
'population' => ['nullable', 'integer', 'min:0'],
|
|
'boundary' => ['required', 'array', 'min:3'],
|
|
'boundary.*.lat' => ['required', 'numeric', 'between:-90,90'],
|
|
'boundary.*.lng' => ['required', 'numeric', 'between:-180,180'],
|
|
];
|
|
}
|
|
}
|