mission->state_id == MissionStates::START_MISSION->value; } /** * Get the validation rules that apply to the request. * * @return array */ public function rules(): array { return [ 'time' => 'required|date', 'end_km' => 'required', ]; } public function after(): array { return [ function (Validator $validator) { $mission = $this->mission; if (strtotime($this->time) < strtotime($mission->start_time)) { $validator->errors()->add( 'time', 'زمان پایان ماموریت باید بعد از زمان شروع ماموریت باشد.' ); } if ($this->end_km < $mission->km) { $validator->errors()->add( 'end_km', 'کیلومتر پایان باید بزرگتر از کیلومتر شروع باشد.' ); } } ]; } }