I have an action that can get two parameters. In validations I set that one parameter is required when another not exists:
[ \'id\'=>\'required_with:code