jeudi 17 août 2017

required_if and required_without_all not working in Laravel

I have the following arrays:

$rules =
Array
(
    [convert_to] => Array
        (
            [0] => required_without_all:convert,width
        )

)

$input =
Array
(
    [height] => 200
    **[width] => 200**
    [max_amount] => 1
    [disk] => local
    [directory] => h
    [prefix] => h
    [max_height] => 1000
    [max_width] => 1000
    [max_filesize] => 562
    [valid_filetypes] => Array
        (
            [0] => jpg
        )

    **[convert] => 0**
    [convert_to] => png
    [quality] => 60
    [resize] => 1
    [resize_height] => 0
    [resize_width] => 0
)

MessageBag {#235 ▼
  #messages: []
  #format: ":message"
}

And I run the code:

print_r($rules);
print_r($input);

$x = Validator::make($input, $rules);

dd($x->errors());

I'm getting no errors even though those fields are present

If I use any of the required_if, required_without, required_without_all etc functions, I still get no errors



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2ibMPP5
via IFTTT

Aucun commentaire:

Enregistrer un commentaire