Created
October 11, 2021 13:39
-
-
Save inxilpro/86add7b33dbcd78512f08971743959f7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $data = [ | |
| 'a2' => null, | |
| 'a3' => '', | |
| 'a4' => [], | |
| 'b2' => null, | |
| 'b3' => '', | |
| 'b4' => [], | |
| 'c2' => null, | |
| 'c3' => '', | |
| 'c4' => [], | |
| 'd2' => null, | |
| 'd3' => '', | |
| 'd4' => [], | |
| ]; | |
| $rules = [ | |
| 'a1' => 'sometimes|required|min:10', | |
| 'a2' => 'sometimes|required|min:10', | |
| 'a3' => 'sometimes|required|min:10', | |
| 'a4' => 'sometimes|required|min:10', | |
| 'b1' => 'filled|min:10', | |
| 'b2' => 'filled|min:10', | |
| 'b3' => 'filled|min:10', | |
| 'b4' => 'filled|min:10', | |
| 'c1' => 'min:10', | |
| 'c2' => 'min:10', | |
| 'c3' => 'min:10', | |
| 'c4' => 'min:10', | |
| 'd1' => 'required|min:10', | |
| 'd2' => 'required|min:10', | |
| 'd3' => 'required|min:10', | |
| 'd4' => 'required|min:10', | |
| ]; | |
| Validator::make($data, $rules)->errors(); | |
| // The a2 field is required. | |
| // The a3 field is required. | |
| // The a4 field is required. | |
| // The b2 field is required. | |
| // The b3 field is required. | |
| // The b4 field is required. | |
| // The c2 must be at least 10 characters. | |
| // The c4 must be at least 10 characters. | |
| // The d1 field is required. | |
| // The d2 field is required. | |
| // The d3 field is required. | |
| // The d4 field is required. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment