Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

saulg's avatar
Level 6

gt validation rule and empty field

Hi There,

I've got validation rules looking like:

$this->validate($request, [
            'range_start' => 'required|integer',
            'range_end' => 'required|integer|gt:range_start,
        ]);

But when user provides empty value for range_start then instead of 302 redirection back to form with error messages I get status code 500 with InvalidArgumentException saying "The values under comparison must be of the same type".

I don't want to present the user with Error 500 - do You know what should I do with that?

Thx in advance

Paweł

0 likes
2 replies
saulg's avatar
Level 6

Unfortunately that does not help (I used required_with).

Please or to participate in this conversation.