Version: v0.7.1 - Beta.  We welcome contributors & feedback.

Input.getAll

$data.getAll($fieldsRulesMap) -> map

Description

Validate multiple input fields and get their values.

Validation

Each input value will be validated per its validation rule. (See Input Validation)

The function will return a Map with the following fields:

Example

fn main {

    $data = Input.getAll({
        sortBy: 'id',
        maxPrice: 'i|min:1|max:130',
    })

    if $data.ok {
        print $data.fields.age
    }
    else {
        print($data.errors)
    }
}

// Post: { userId: 100, age: 33 }
//= 33

// Post: { userId: 100, age: 1000 }
// [
//     { field: 'age', error: 'Must be 130 or less.' },
// ]

See Also