laravel/laravel — pull request #401 by ShawnMcCool (2012-03-09 22:02:19+00:00)
Title: Created mutated_attributes array within the Validator class

This allows the Validator to be used for both validation and mutation. I considered creating a Mutator class that could be used for data sanitation, etc. However, I feel that there'd be quite a bit of redundancy not only between the implementation of the Mutator and the Validator but in the configuration of the model.

Usage:

$input = array('name' => ' Taylor Otwell ');
$rules = array('name' => 'trim');

$validation = Validator::make($input, $rules);
$validation->valid();

echo $validation->attributes['name'];
> " Taylor Otwell "

echo $validation->mutated_attributes['name'];
> "Taylor Otwell"

Signed-off-by: Shawn McCool