{"action":"created","issue":{"url":"https://api.github.com/repos/laravel/framework/issues/8003","labels_url":"https://api.github.com/repos/laravel/framework/issues/8003/labels{/name}","comments_url":"https://api.github.com/repos/laravel/framework/issues/8003/comments","events_url":"https://api.github.com/repos/laravel/framework/issues/8003/events","html_url":"https://github.com/laravel/framework/pull/8003","id":61325291,"number":8003,"title":"[5.0] Multi-Level Nested Array Validation","user":{"login":"mattwells","id":507858,"avatar_url":"https://avatars.githubusercontent.com/u/507858?v=3","gravatar_id":"","url":"https://api.github.com/users/mattwells","html_url":"https://github.com/mattwells","followers_url":"https://api.github.com/users/mattwells/followers","following_url":"https://api.github.com/users/mattwells/following{/other_user}","gists_url":"https://api.github.com/users/mattwells/gists{/gist_id}","starred_url":"https://api.github.com/users/mattwells/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattwells/subscriptions","organizations_url":"https://api.github.com/users/mattwells/orgs","repos_url":"https://api.github.com/users/mattwells/repos","events_url":"https://api.github.com/users/mattwells/events{/privacy}","received_events_url":"https://api.github.com/users/mattwells/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/laravel/framework/labels/low%20priority","name":"low priority","color":"bfe5bf"},{"url":"https://api.github.com/repos/laravel/framework/labels/proposal","name":"proposal","color":"d4c5f9"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-03-14T00:55:09Z","updated_at":"2015-03-16T02:38:20Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/laravel/framework/pulls/8003","html_url":"https://github.com/laravel/framework/pull/8003","diff_url":"https://github.com/laravel/framework/pull/8003.diff","patch_url":"https://github.com/laravel/framework/pull/8003.patch"},"body":"Alternative to Validator::each() #4024 that supports multi-dimensional nested arrays.\r\n\r\n    $rules = [\r\n        'children' => [\r\n            'array',\r\n            'between:2,6',\r\n            ['each', \r\n                'name' => 'required|min:3',\r\n                'grandchildren' => [\r\n                    'array',\r\n                    ['each', 'name' => 'required|min:3']\r\n                ],\r\n            ],\r\n        ],\r\n    ];\r\n\r\nI would like to add the functionality so that an array of items (such as string) could be validated using `['each', 'alpha|between3,8']` would loop through each element in the array, applying the rules as it goes. \r\n\r\nPlease let me know if you feel this would benefit Laravel and I will continue working on it."},"comment":{"url":"https://api.github.com/repos/laravel/framework/issues/comments/81356904","html_url":"https://github.com/laravel/framework/pull/8003#issuecomment-81356904","issue_url":"https://api.github.com/repos/laravel/framework/issues/8003","id":81356904,"user":{"login":"JosephSilber","id":1403741,"avatar_url":"https://avatars.githubusercontent.com/u/1403741?v=3","gravatar_id":"","url":"https://api.github.com/users/JosephSilber","html_url":"https://github.com/JosephSilber","followers_url":"https://api.github.com/users/JosephSilber/followers","following_url":"https://api.github.com/users/JosephSilber/following{/other_user}","gists_url":"https://api.github.com/users/JosephSilber/gists{/gist_id}","starred_url":"https://api.github.com/users/JosephSilber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JosephSilber/subscriptions","organizations_url":"https://api.github.com/users/JosephSilber/orgs","repos_url":"https://api.github.com/users/JosephSilber/repos","events_url":"https://api.github.com/users/JosephSilber/events{/privacy}","received_events_url":"https://api.github.com/users/JosephSilber/received_events","type":"User","site_admin":false},"created_at":"2015-03-16T02:38:20Z","updated_at":"2015-03-16T02:38:20Z","body":"[Dayle uses a special `*` attribute key](https://github.com/daylerees/sanitizer/blob/master/src/Sanitizer.php#L85-L100) to indicate that you want to validate all items in the array.\r\n\r\nMaybe we can implement something like that?\r\n\r\nSo your example would look something like this:\r\n\r\n```php\r\n$rules = [\r\n    'children' => [\r\n        'array',\r\n        'between:2,6',\r\n        '*' => [\r\n            'name' => 'required|min:3',\r\n            'grandchildren' => [\r\n                'array',\r\n                '*' => [\r\n                    'name' => 'required|min:3'\r\n                ]\r\n            ],\r\n        ],\r\n    ],\r\n];\r\n```\r\n\r\nLooks a little clearer to me."}}