mako-framework/framework — pull request #94 by aldoanizio (2014-04-29 12:38:10+00:00)
Title: Added 'config_exists' and 'config_key_exists' to validation plugins

Usefull if you have a 'huge' config file and want to check if a value exists or if is a valid array key in a config file. It's an alternative to 'in:foo,bar,baz'.

## Eg 1.: config file "brazil_states_ acronym.php"
return
[
'ac',
'ba',
'ce',
'es',
... more 23 itens
] ;
$validator = $this->validator->create($this->request->post(),
[
"state" => "required|config_exists:brazil_states_ acronym",
]);

## Eg 2: config file "oficial_bank_codes.php"
return
[
'067' => 'Bank Foo',
'485' => 'Bank Bar ',
'723' => 'Bank Hello World',
'126' => 'Bank Example 1',
'459' => 'Bank Example 2',
... more 127 itens
] ;
$validator = $this->validator->create($this->request->post(),
[
"bank_code" => "required|config_key_exists:oficial_bank_codes",
]);