{"action":"closed","issue":{"url":"https://api.github.com/repos/dwightwatson/validating/issues/200","repository_url":"https://api.github.com/repos/dwightwatson/validating","labels_url":"https://api.github.com/repos/dwightwatson/validating/issues/200/labels{/name}","comments_url":"https://api.github.com/repos/dwightwatson/validating/issues/200/comments","events_url":"https://api.github.com/repos/dwightwatson/validating/issues/200/events","html_url":"https://github.com/dwightwatson/validating/issues/200","id":328463465,"node_id":"MDU6SXNzdWUzMjg0NjM0NjU=","number":200,"title":"Objects or closures in rules unsupported","user":{"login":"Propaganistas","id":6680176,"node_id":"MDQ6VXNlcjY2ODAxNzY=","avatar_url":"https://avatars3.githubusercontent.com/u/6680176?v=4","gravatar_id":"","url":"https://api.github.com/users/Propaganistas","html_url":"https://github.com/Propaganistas","followers_url":"https://api.github.com/users/Propaganistas/followers","following_url":"https://api.github.com/users/Propaganistas/following{/other_user}","gists_url":"https://api.github.com/users/Propaganistas/gists{/gist_id}","starred_url":"https://api.github.com/users/Propaganistas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Propaganistas/subscriptions","organizations_url":"https://api.github.com/users/Propaganistas/orgs","repos_url":"https://api.github.com/users/Propaganistas/repos","events_url":"https://api.github.com/users/Propaganistas/events{/privacy}","received_events_url":"https://api.github.com/users/Propaganistas/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-06-01T10:22:09Z","updated_at":"2018-06-17T19:06:58Z","closed_at":"2018-06-17T19:06:58Z","author_association":"CONTRIBUTOR","body":"Hi\r\n\r\nA rather important heads up: according to the official [docs](https://laravel.com/docs/5.6/validation#custom-validation-rules) Laravel also supports Rule objects and closures in a rules array:\r\n\r\n```php\r\nuse App\\Rules\\Uppercase;\r\n\r\n$rules = [\r\n    'required',\r\n    new Uppercase,\r\n    function($attribute, $value, $fail) {\r\n        if ($value === 'foo') {\r\n            return $fail($attribute.' is invalid.');\r\n        }\r\n    },\r\n];\r\n```\r\n\r\nThe package currently errors  in the `injectUniqueIdentifier()` method. When exploding the rule, it is assumed the rule is always a string:\r\n```php\r\n$parameters = explode(':', $rule);\r\n```\r\n\r\nI just ran into this issue and thought I'd let you know. I'm not sending in a PR; seems a rather easy fix to me so go ahead."}}
{"actor":{"display_login":"Propaganistas"}}