Back

Laravel validation tip (as I've just run into this):

'required_if' requires 'nullable' if you have additional rules.

e.g. 'registration_opens_at' => 'required_if:type,1|nullable|date|after_or_equal:today',

Without nullable, the date and after_or_equal rules were failing even if the 'type' field wasn't 1.

154

  • No matching results...
  • Searching...

/ 1000