45 lines
1.7 KiB
PHP
45 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests\DropOff;
|
|
|
|
use App\Models\DropOffPoint;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Illuminate\Validation\Rule;
|
|
|
|
class UpdateDropOffPointRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public function rules(): array
|
|
{
|
|
$id = $this->route('drop_off_point')?->id;
|
|
|
|
return [
|
|
'name' => ['sometimes', 'required', 'string', 'max:191'],
|
|
'code' => [
|
|
'sometimes', 'required', 'string', 'max:32',
|
|
Rule::unique('drop_off_points', 'code')->whereNull('deleted_at')->ignore($id),
|
|
],
|
|
'barangay_id' => ['sometimes', 'nullable', 'integer', 'exists:barangays,id'],
|
|
'lat' => ['sometimes', 'required_with:lng', 'numeric', 'between:-90,90'],
|
|
'lng' => ['sometimes', 'required_with:lat', 'numeric', 'between:-180,180'],
|
|
'geofence_wkt' => ['sometimes', 'nullable', 'string'],
|
|
'address_line' => ['sometimes', 'required', 'string', 'max:255'],
|
|
'capacity_kg' => ['sometimes', 'nullable', 'integer', 'min:0'],
|
|
'operating_hours' => ['sometimes', 'nullable', 'array'],
|
|
'accepted_waste_types' => ['sometimes', 'nullable', 'array'],
|
|
'status' => ['sometimes', Rule::in([
|
|
DropOffPoint::STATUS_ACTIVE,
|
|
DropOffPoint::STATUS_MAINTENANCE,
|
|
DropOffPoint::STATUS_CLOSED,
|
|
])],
|
|
'photo_path' => ['sometimes', 'nullable', 'string', 'max:255'],
|
|
'contact_person' => ['sometimes', 'nullable', 'string', 'max:191'],
|
|
'contact_phone' => ['sometimes', 'nullable', 'string', 'max:32'],
|
|
];
|
|
}
|
|
}
|