laravelbook/ardent — pull request #166 by tbergeron (2014-02-06 23:03:40+00:00)
Title: save accepts Input::all() fixes "sometimes" validator

That validator only validates the field when it is specified in the form's data (when it's in the attributes). Ardent used the model's attributes instead of using the actual data coming from the form.

i.e. Saving a user without checking if his username is unique on every save, would simply never work.
```php
public static $rules = array(
'username' => 'sometimes|required|unique:users'
);
```

Now we can do:
```php
public function update($id)
$user = User::findOrFail($id);

// NOTE: No need to do ->fill() as ->save() now handles this part.
if ($user->save(Input::all())) {
// Validated!
} else {
return Redirect::back()->withInput()->withErrors($user->errors());
}
}
```

`save` method now looks like this:
```php
public function save(array $data = null,
array $rules = array(),
array $customMessages = array(),
array $options = array(),
Closure $beforeSave = null,
Closure $afterSave = null) {
// ...
```

Hope this helps somebody ;-)