Skip to main content

composer.json

Open in GitHub
{
"require": {
"php": "^7.3",
//
"venturecraft/revisionable": "1.*"
}
}

app/Comment.php

Open in GitHub
use Illuminate\Database\Eloquent\Model;
use Venturecraft\Revisionable\RevisionableTrait;
 
class Comment extends Model
{
use RevisionableTrait;
 
protected $keepRevisionOf = ['body'];
}

resources/views/comments/history.blade.php

Open in GitHub
@foreach($comment->revisionHistory as $history )
<p class="history">
{{ $history->created_at->diffForHumans() }}, {{ $history->userResponsible()->name }} {{trans('messages.changed')}} <strong>{{ $history->fieldName() }}</strong> {{trans('messages.changed_from')}} <code>{{ $history->oldValue() }}</code> {{trans('messages.changed_to')}} <code>{{ $history->newValue() }}</code>
</p>
@endforeach

We'd Love Your Feedback

Tell us what you like or what we can improve

Feel free to share anything you like or dislike about this page or the platform in general.