{"action":"reopened","issue":{"url":"https://api.github.com/repos/particle-php/Validator/issues/85","labels_url":"https://api.github.com/repos/particle-php/Validator/issues/85/labels{/name}","comments_url":"https://api.github.com/repos/particle-php/Validator/issues/85/comments","events_url":"https://api.github.com/repos/particle-php/Validator/issues/85/events","html_url":"https://github.com/particle-php/Validator/issues/85","id":107513331,"number":85,"title":"add a requiredIf/optionalUnless","user":{"login":"skoop","id":90003,"avatar_url":"https://avatars.githubusercontent.com/u/90003?v=3","gravatar_id":"","url":"https://api.github.com/users/skoop","html_url":"https://github.com/skoop","followers_url":"https://api.github.com/users/skoop/followers","following_url":"https://api.github.com/users/skoop/following{/other_user}","gists_url":"https://api.github.com/users/skoop/gists{/gist_id}","starred_url":"https://api.github.com/users/skoop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/skoop/subscriptions","organizations_url":"https://api.github.com/users/skoop/orgs","repos_url":"https://api.github.com/users/skoop/repos","events_url":"https://api.github.com/users/skoop/events{/privacy}","received_events_url":"https://api.github.com/users/skoop/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-09-21T13:35:06Z","updated_at":"2015-09-22T07:48:52Z","closed_at":null,"body":"Sometimes you may have fields that are optional in some situations, but required in other situations. For instance in a form where one should fill in invoice address details with an optional different delivery address. Based on the checkbox 'different delivery address', the delivery address fields are either required or optional.\r\n\r\nThe situation I'm running into right now is that I mark the fields as optional. Because of this, the validations after optional() are not run when the field is empty. This is correct behaviour when people don't check the 'different delivery address' checkbox, but when they *do* check the checkbox, it still won't run the validations.\r\n\r\nI propose a requiredIf or optionalUnless that would contain a callable and would receive all fields and would mark the field as required if the callable returns true or optional if the callback returns falls. "}}