*/ public function rules(): array { return [ 'enter_time' => 'required|date', 'end_km'=> 'required|string', ]; } public function after(): array { return [ function (Validator $validator) { if (strtotime($this->enter_time) < strtotime($this->violation->exit_time)) { $validator->errors()->add( 'time', 'زمان پایان ماموریت باید بعد از زمان شروع ماموریت باشد.' ); } if ($this->end_km < $this->violation->km) { $validator->errors()->add( 'end_km', 'کیلومتر پایان باید بزرگتر از کیلومتر شروع باشد.' ); } } ]; } }