add validation
This commit is contained in:
@@ -41,7 +41,7 @@ class FinishRequest extends FormRequest
|
||||
'زمان پایان ماموریت باید بعد از زمان شروع ماموریت باشد.'
|
||||
);
|
||||
}
|
||||
if ($this->end_km < $mission->km) {
|
||||
if ($this->end_km <= $mission->km) {
|
||||
$validator->errors()->add(
|
||||
'end_km',
|
||||
'کیلومتر پایان باید بزرگتر از کیلومتر شروع باشد.'
|
||||
|
||||
@@ -26,7 +26,7 @@ class ClarifyUnauthorizedExitRequest extends FormRequest
|
||||
{
|
||||
return [
|
||||
'item_id' => 'required|exists:info_items,item',
|
||||
'sub_item_id' => 'required|exists:info_items,sub_item',
|
||||
'sub_item_id' => 'required|exists:info_items,id',
|
||||
'rahdaran' => 'array',
|
||||
'rahdaran.*' => 'exists:rahdaran,id',
|
||||
'driver' => 'required|integer|exists:rahdaran,id',
|
||||
|
||||
@@ -27,7 +27,7 @@ class ContinueMissionRequest extends FormRequest
|
||||
{
|
||||
return [
|
||||
'item_id' => 'required|exists:info_items,item',
|
||||
'sub_item_id' => 'required|exists:info_items,sub_item',
|
||||
'sub_item_id' => 'required|exists:info_items,id',
|
||||
'rahdaran' => 'array',
|
||||
'rahdaran.*' => 'exists:rahdaran,id',
|
||||
'machine_id' => 'required|integer|exists:cmms_machines,id',
|
||||
@@ -58,7 +58,7 @@ class ContinueMissionRequest extends FormRequest
|
||||
);
|
||||
}
|
||||
}
|
||||
if ($this->end_km < $this->mission->km) {
|
||||
if ($this->end_km <= $this->mission->km) {
|
||||
$validator->errors()->add(
|
||||
'end_km',
|
||||
'کیلومتر پایان باید بزرگتر از کیلومتر شروع باشد.'
|
||||
|
||||
@@ -26,7 +26,7 @@ class StoreRequest extends FormRequest
|
||||
{
|
||||
return [
|
||||
'item_id' => 'required|exists:info_items,item',
|
||||
'sub_item_id' => 'required|exists:info_items,sub_item',
|
||||
'sub_item_id' => 'required|exists:info_items,id',
|
||||
'rahdaran' => 'array',
|
||||
'rahdaran.*' => 'exists:rahdaran,id',
|
||||
'requested_machines' => 'required|array',
|
||||
|
||||
@@ -27,7 +27,7 @@ class UpdateRequest extends FormRequest
|
||||
{
|
||||
return [
|
||||
'item_id' => 'required|exists:info_items,item',
|
||||
'sub_item_id' => 'required|exists:info_items,sub_item',
|
||||
'sub_item_id' => 'required|exists:info_items,id',
|
||||
'rahdaran' => 'array',
|
||||
'rahdaran.*' => 'exists:rahdaran,id',
|
||||
'requested_machines' => 'required|array',
|
||||
|
||||
@@ -41,7 +41,7 @@ class UpdateRequest extends FormRequest
|
||||
'زمان پایان ماموریت باید بعد از زمان شروع ماموریت باشد.'
|
||||
);
|
||||
}
|
||||
if ($this->end_km < $this->violation->km) {
|
||||
if ($this->end_km <= $this->violation->km) {
|
||||
$validator->errors()->add(
|
||||
'end_km',
|
||||
'کیلومتر پایان باید بزرگتر از کیلومتر شروع باشد.'
|
||||
|
||||
@@ -24,7 +24,7 @@ class ReportMachineService
|
||||
FROM missions m
|
||||
JOIN cmms_machines cm ON cm.id = m.machine_id
|
||||
WHERE m.state_id = 4 AND m.start_time >= :from AND m.finish_time <= :to
|
||||
GROUP BY machine_id;";
|
||||
GROUP BY machine_id ORDER BY missions DESC;";
|
||||
|
||||
return DB::select($sql, [
|
||||
'from' => $from,
|
||||
@@ -42,7 +42,7 @@ class ReportMachineService
|
||||
FROM missions m
|
||||
JOIN cmms_machines cm ON cm.id = m.machine_id
|
||||
WHERE m.state_id = 4 AND start_time >= :from AND finish_time <= :to AND m.province_id = :province_id
|
||||
GROUP BY machine_id;";
|
||||
GROUP BY machine_id ORDER BY missions DESC;";
|
||||
|
||||
return DB::select($sql, [
|
||||
'from' => $from,
|
||||
@@ -63,7 +63,7 @@ class ReportMachineService
|
||||
FROM missions m
|
||||
JOIN cmms_machines cm ON cm.id = m.machine_id
|
||||
WHERE m.state_id = 4 AND m.start_time >= :from AND m.finish_time <= :to
|
||||
GROUP BY cm.car_type;";
|
||||
GROUP BY cm.car_type ORDER BY missions DESC;";
|
||||
|
||||
return DB::select($sql, [
|
||||
'from' => $from,
|
||||
@@ -84,7 +84,7 @@ class ReportMachineService
|
||||
FROM missions m
|
||||
JOIN cmms_machines cm ON cm.id = m.machine_id
|
||||
WHERE m.state_id = 4 AND m.start_time >= :from AND m.finish_time <= :to AND m.province_id = :province_id
|
||||
GROUP BY cm.car_type;";
|
||||
GROUP BY cm.car_type ORDER BY missions DESC;";
|
||||
|
||||
return DB::select($sql, [
|
||||
'from' => $from,
|
||||
@@ -105,7 +105,7 @@ class ReportMachineService
|
||||
SUM(m.end_km - m.km) AS func
|
||||
FROM missions m
|
||||
WHERE m.state_id = 4 AND m.start_time >= :from AND m.finish_time <= :to
|
||||
GROUP BY m.driver_id;";
|
||||
GROUP BY m.driver_id ORDER BY missions DESC;";
|
||||
|
||||
return DB::select($sql, [
|
||||
'from' => $from,
|
||||
@@ -126,7 +126,7 @@ class ReportMachineService
|
||||
SUM(m.end_km - m.km) AS func
|
||||
FROM missions m
|
||||
WHERE m.state_id = 4 AND m.start_time >= :from AND m.finish_time <= :to AND province_id = :province_id
|
||||
GROUP BY m.driver_id;";
|
||||
GROUP BY m.driver_id ORDER BY missions DESC;";
|
||||
|
||||
return DB::select($sql, [
|
||||
'from' => $from,
|
||||
|
||||
@@ -34,7 +34,7 @@ class RequestPortalService
|
||||
'description', 'requested_machines', 'type', 'type_fa', 'start_date', 'state_id',
|
||||
'end_date', 'request_date', 'end_point', 'encoded_route', 'zone', 'zone_fa', 'start_time', 'finish_time',
|
||||
'code', 'category_id', 'category_name', 'explanation', 'city_id', 'city_name', 'province_id', 'station_name',
|
||||
'driver_id', 'driver_name'
|
||||
'driver_id', 'driver_name', 'machine_id', 'item_id', 'sub_item_id'
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user