Files
backend/app/Http/Requests/V3/Mission/Violation/UpdateRequest.php
2026-06-14 10:05:13 +03:30

47 lines
1.2 KiB
PHP

<?php
namespace App\Http\Requests\V3\Mission\Violation;
use App\Enums\MissionStates;
use Carbon\Carbon;
use Illuminate\Contracts\Validation\ValidationRule;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Validator;
class UpdateRequest 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 [
'enter_station' => 'required|date',
];
}
public function after(): array
{
return [
function (Validator $validator) {
if (strtotime($this->violation->exit_station) < strtotime($this->enter_station)) {
$validator->errors()->add(
'time',
'زمان پایان ماموریت باید بعد از زمان شروع ماموریت باشد.'
);
}
}
];
}
}