41 lines
1.5 KiB
PHP
41 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests\DropOff;
|
|
|
|
use App\Models\DropOffPoint;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Illuminate\Validation\Rule;
|
|
|
|
class StoreDropOffPointRequest 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('drop_off_points', 'code')->whereNull('deleted_at')],
|
|
'barangay_id' => ['nullable', 'integer', 'exists:barangays,id'],
|
|
'lat' => ['required', 'numeric', 'between:-90,90'],
|
|
'lng' => ['required', 'numeric', 'between:-180,180'],
|
|
'geofence_wkt' => ['nullable', 'string'],
|
|
'address_line' => ['required', 'string', 'max:255'],
|
|
'capacity_kg' => ['nullable', 'integer', 'min:0'],
|
|
'operating_hours' => ['nullable', 'array'],
|
|
'accepted_waste_types' => ['nullable', 'array'],
|
|
'accepted_waste_types.*' => ['string', 'max:50'],
|
|
'status' => ['nullable', Rule::in([
|
|
DropOffPoint::STATUS_ACTIVE,
|
|
DropOffPoint::STATUS_MAINTENANCE,
|
|
DropOffPoint::STATUS_CLOSED,
|
|
])],
|
|
'photo_path' => ['nullable', 'string', 'max:255'],
|
|
'contact_person' => ['nullable', 'string', 'max:191'],
|
|
'contact_phone' => ['nullable', 'string', 'max:32'],
|
|
];
|
|
}
|
|
}
|