Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
rajkumardusad committed Mar 9, 2021
1 parent 427c504 commit 2b31f6f
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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'
]
]
];

Expand All @@ -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
Expand Down

0 comments on commit 2b31f6f

Please sign in to comment.