Skip to content

Conditions

MohammadAli Arjomand edited this page Jul 29, 2023 · 5 revisions

In Pouria valid you have 2 conditions type

Conditions with value

Like min and max, you must pass value to this conditions like ...

$pouria->conditions([
    "name" => [
        "min=5",
        "max=16"
    ]
]);

In this example 5 is the value of min and 16 is the value of max

Conditions without value

Like required, you don't pass any values to this conditions like ...

$pouria->conditions([
    "name" => [
        "required"
    ]
]);

Constants

You can use constant for conditions like ...

$pouria->conditions([
    "name" => [
        REQUIRED,
        MINIMUM . 5,
        MAXIMUM . 16
    ]
]);

All Conditions

Title Constant Example Description
Required REQUIRED required Field is required
Minimum MINIMUM min=5 Set minimum length of field
Maximum MAXIMUM max=16 Set maximum length of field
Count COUNT count=10 Length of field can only be this value
Just JUST just=ABCD Set characters on field to just can contains it
No Characters NOCHAR nochar=!@#$%^&* Set character(s) on field to can't contains it
Has HAS has=my name is Set word(s) on field to must contains it
Has Characters HASCHAR haschar=POI Set characters on field to must contains anyone
Start START start=_token= Field must start with this value
End END end=bot Field must end with this value
RegEx REGEX regex=/[A-Za-z]+/ Field must match by this regex
E-Mail EMAIL email Field must be email
Phone PHONE phone Field must be phone number
Number NUMBER number Field must be a number (integer or float)
Clone this wiki locally