laravel/framework — pull request #5489 by YSimple (2014-08-18 08:50:23+00:00)
Title: added validator extract values if rules passes to Illuminate/Validation/...

Added extract values on validators to remove data manipulation when passing user input into a model, fields in rules that don't exist in __Inputs__ will be ignored if the __Inputs__ passes.

example (update operation on user):

$rules = [
'username' => 'required|alpha_num|min:3',
'age' => 'numeric|min:15|max:80'
];

$inputs = [
'username' => 'ySimple',
'password' => 'changes not allowed'
];

$validator = Validator::make($input, $rules);
$result = $validator->extract();
print_r($result); // [ 'username' => 'gits' ]