0

Laravel validation - field A required unless when one of two conditions is acheived: field B filled or filed C has a specific value

Hi I have control panel for news website with three filed source writer_id place_id

I need "source" to be required except two situtions: 1/ "place_id" = 4 2/ "writer_id" is filled In these situtions I havenot to insert any value in "source"

I tried the next order but fiald: request()->validate([ 'source' =>'required_unless:place_id,4 || required_without:writer_id', ]);

But if insert one of these condition, it succeed.

How I make the two conditions work together?

failed

I need "source" to be required except two situtions: 1/ "place_id" = 4 2/ "writer_id" is filled In these situtions I havenot to insert any value in "source"

'source' =>'required_unless:place_id,4 || required_without:writer_id', ]); >> Failed

0 Answers0