52 lines
1.1 KiB
PHP
52 lines
1.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Modules\RestaurantDelivery\Http\Requests;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class AssignRiderRequest extends FormRequest
|
|
{
|
|
/**
|
|
* Determine if the user is authorized to make this request.
|
|
*/
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* Get the validation rules that apply to the request.
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'rider_id' => ['required', 'integer', 'exists:restaurant_riders,id'],
|
|
'force_assign' => ['boolean'],
|
|
'notes' => ['nullable', 'string', 'max:255'],
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Get custom attributes for validator errors.
|
|
*/
|
|
public function attributes(): array
|
|
{
|
|
return [
|
|
'rider_id' => 'rider',
|
|
'force_assign' => 'force assignment',
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Prepare the data for validation.
|
|
*/
|
|
protected function prepareForValidation(): void
|
|
{
|
|
$this->merge([
|
|
'force_assign' => $this->boolean('force_assign'),
|
|
]);
|
|
}
|
|
}
|