add end_km to violations

This commit is contained in:
2026-06-15 10:32:04 +03:30
parent 1be9315b73
commit 439f69af29
5 changed files with 53 additions and 0 deletions

View File

@@ -38,6 +38,7 @@ class ContinueMissionRequest extends FormRequest
'encoded_route' => 'required|string',
'explanation' => 'required|string',
'category_id' => 'required|in:1,2,3',
'end_km'=> 'required|string',
];
}
@@ -56,6 +57,18 @@ class ContinueMissionRequest extends FormRequest
);
}
}
if ($this->end_km < $this->mission->km) {
$validator->errors()->add(
'end_km',
'کیلومتر پایان باید بزرگتر از کیلومتر شروع باشد.'
);
}
if (strtotime($this->end_date) < strtotime($this->mission->start_time)) {
$validator->errors()->add(
'time',
'زمان پایان ماموریت باید بعد از زمان شروع ماموریت باشد.'
);
}
},
];
}

View File

@@ -27,6 +27,7 @@ class UpdateRequest extends FormRequest
{
return [
'enter_time' => 'required|date',
'end_km'=> 'required|string',
];
}
@@ -40,6 +41,12 @@ class UpdateRequest extends FormRequest
'زمان پایان ماموریت باید بعد از زمان شروع ماموریت باشد.'
);
}
if ($this->end_km < $this->violation->km) {
$validator->errors()->add(
'end_km',
'کیلومتر پایان باید بزرگتر از کیلومتر شروع باشد.'
);
}
}
];
}