VentureCraft/revisionable — pull request #42 by lennybr (2014-03-11 17:20:06+00:00)
Title: Add pre-formatted history function to Revision model

This commit closes #4.

Added pre-formatted function to Revision Model to make it easier to display multiple histories consistently across views. You can still display the revision history as before, putting all of the formatting in the view:

```
@foreach($account->revisionHistory as $history )

{{ $history->userResponsible()->first_name }} changed {{ $history->fieldName() }} from {{ $history->oldValue() }} to {{ $history->newValue() }}

@endforeach
```
but you can now also display pre-formatted revision history with:

```
@foreach( $account->revisionHistory as $history )
{{ $history->preFormatted('date') }}
@endforeach
```
And the optional 'date' variable just adds the revision history date to the format. If triggered, it pulls from the model's 'created_at' column. In case the model doesn't include Laravel's 'created_at' and 'updated_at' fields, it just ignores the date trigger instead of throwing an error.

And the pre-format is specified in Revision Model (Revision.php).