Welcome Guest, Not a member yet? Register   Sign In
conditional validation in Model
#1

Hi,
I am transfering all my validation to my Models.
But I now have a 'problem' with a validation rule:

PHP Code:
    protected $validationRules = [
        'name'    => 'required|min_length[3]|alpha_dash|is_unique[navigations.name,id,{id}]',
        'category' => 'required_with[auto_build]',
        'depth' => 'required_with[auto_build]|less_than[4]'
    ]; 

It's about the DEPTH rule.
depth is only required when auto_build is present, that works.
But for the less_than I also want the validator to check for the auto_build rule.
Is is possible to have conditional validation in the Model?
Reply


Messages In This Thread
conditional validation in Model - by sjender - 02-09-2023, 12:51 PM
RE: conditional validation in Model - by sjender - 02-22-2023, 08:19 AM



Theme © iAndrew 2016 - Forum software by © MyBB