K
K
kaxa32012019-05-16 11:37:06
Laravel
kaxa3201, 2019-05-16 11:37:06

How to validate in my cases?

I use the standard Laravel validator

$validator = Validator::make($params, [
            'filter.resource.id.$eq' => 'integer',
        ]);

the difficulty is that $eq can be different ($gte, $lt, $lte, etc.) and all of them must have an integer value.
don't want to do that
$validator = Validator::make($params, [
            'filter.resource.id.$eq' => 'integer',
            'filter.resource.id.$gte' => 'integer',
        ]);

because the code gets very large.
Please tell me, is there any other way to write this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
NubasLol, 2019-05-16
@NubasLol

'filter.resource.id.*' => 'integer',

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question