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

p3ym4n's avatar

unique validation issue with empty values

Hi, I have a table with a unique index on three columns of it. and this is my validation code :

    'title'           => [
        'string',
        'present',
        Rule::unique('product_combinations', 'title')
            ->where('product_id', $request->input('product_id', 0))
            ->where('tab_id', $request->input('tab_id', 0))
            ->ignore($model->id),
    ],

the rule only works when the title input is not empty. so what I can do ?

0 likes
1 reply
p3ym4n's avatar

Currently I solve it by an extra check before validation. But I still wonder to know the reason .

Please or to participate in this conversation.