50 lines
1.5 KiB
PHP
50 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests\V3\Mission\RequestPortal;
|
|
|
|
use Illuminate\Contracts\Validation\ValidationRule;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class NoProcessRequest 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.
|
|
*
|
|
* @return array<string, ValidationRule|array|string>
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'rahdaran' => 'array',
|
|
'rahdaran.*' => 'exists:rahdaran,id',
|
|
'machines' => 'required|array',
|
|
'machines.*' => 'required|integer|exists:cmms_machines,id',
|
|
'driver' => 'required|integer|exists:rahdaran,id',
|
|
'zone' => 'required|in:1,2,3',
|
|
'start_date' => 'required|date',
|
|
'end_date' => 'required|date|after:start_date|before:now',
|
|
'end_point' => 'required|string',
|
|
'area' => 'required|array',
|
|
'area.type' => 'required|string',
|
|
'area.coordinates' => 'required|array',
|
|
'category_id' => 'required|in:1,2,3',
|
|
];
|
|
}
|
|
|
|
public function messages(): array
|
|
{
|
|
return [
|
|
'end_date.before' => 'تاریخ پایان باید قبل از زمان فعلی باشد.',
|
|
'end_date.after' => 'تاریخ پایان نباید قبل از تاریخ شروع باشد.',
|
|
];
|
|
}
|
|
}
|