Closed ponasromas closed 1 year ago
How to get filtered values?
$data = [ 'username' => 'Jonny', 'email' => 'john.doe@domain.com', ]; $rules = [ 'username' => [ 'filter' => 'trim', 'validate' => 'required|min_len,10|max_len,128|unique', ], 'email' => [ 'filter' => 'trim', 'validate' => 'required|valid_email|email_host', ] ]; $valid = $validation->validate($rules, $data);
Returns only TRUE/FALSE. In GUMP there was approach like this:
$valid = $validation->validate($rules, $data);
if validation was "TRUE", than $valid['username'] return filtered value. How to achieve this?
$valid['username']
the filter is automatically applied to $data. As $data is handled as reference, the filter is already applied to $data after calling this function.
$data
Aha, got it. A bit magical :) but convenient.
How to get filtered values?
Returns only TRUE/FALSE. In GUMP there was approach like this:
$valid = $validation->validate($rules, $data);
if validation was "TRUE", than
$valid['username']
return filtered value. How to achieve this?