{"action":"closed","issue":{"url":"https://api.github.com/repos/laravel/framework/issues/12361","repository_url":"https://api.github.com/repos/laravel/framework","labels_url":"https://api.github.com/repos/laravel/framework/issues/12361/labels{/name}","comments_url":"https://api.github.com/repos/laravel/framework/issues/12361/comments","events_url":"https://api.github.com/repos/laravel/framework/issues/12361/events","html_url":"https://github.com/laravel/framework/issues/12361","id":134554239,"number":12361,"title":"Provide a way to hook `sometimes` validation rules on FormRequest","user":{"login":"Daskul","id":1907740,"avatar_url":"https://avatars.githubusercontent.com/u/1907740?v=3","gravatar_id":"","url":"https://api.github.com/users/Daskul","html_url":"https://github.com/Daskul","followers_url":"https://api.github.com/users/Daskul/followers","following_url":"https://api.github.com/users/Daskul/following{/other_user}","gists_url":"https://api.github.com/users/Daskul/gists{/gist_id}","starred_url":"https://api.github.com/users/Daskul/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Daskul/subscriptions","organizations_url":"https://api.github.com/users/Daskul/orgs","repos_url":"https://api.github.com/users/Daskul/repos","events_url":"https://api.github.com/users/Daskul/events{/privacy}","received_events_url":"https://api.github.com/users/Daskul/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-02-18T11:26:32Z","updated_at":"2016-02-19T13:48:55Z","closed_at":"2016-02-19T13:48:55Z","body":"Is there a way to specify `sometimes` validation on FormRequest like the one below?\r\n\r\n// from https://laravel.com/docs/5.2/validation#available-validation-rules\r\n$v->sometimes('reason', 'required|max:500', function($input) {\r\n    return $input->games >= 100;\r\n});\r\n\r\nthe validator instance in the validate() method is transient.\r\nif I call $v = FormRequest::getValidatorInstance lets say on constructor and do\r\n\r\n$v->sometimes('reason', 'required|max:500', function($input) {\r\n    return $input->games >= 100;\r\n});\r\n\r\nill still have fresh validator instance inside validate() method and disregard the above validation."}}