diff --git a/README.md b/README.md index f2f477e..8ce955d 100644 --- a/README.md +++ b/README.md @@ -125,12 +125,16 @@ $data = [ [ 'name' => 'abc xyz', 'gender' => 'male', - 'email' => 'abc@gmail.com' + 'contact' => [ + 'email' => 'xyz@gmail.com' + ] ], [ 'name' => 'xyz abc', 'gender' => 'male', - 'email' => 'xyz@gmail.com' + 'contact' => [ + 'email' => 'xyz@gmail.com' + ] ] ]; @@ -146,12 +150,20 @@ $validator->rules([ 'lowercase' => true, 'in' => ['male', 'female', 'other'] ], - 'email' => [ + 'contact.email' => [ 'required' => true, 'email' => true, ] ]); +//Set validation messages +$validator->messages([ + 'contact.email' => [ + 'required' => 'Please enter email address.', + 'email' => 'Please enter valid email address.' + ] +]); + //Validate multiple sets of data if($validator->validate($data, true)) { //Ok data is valid