-
composer.json
Open in GitHub{ "require": { "php": "^7.3", // "venturecraft/revisionable": "1.*" } }
-
app/Comment.php
Open in GitHubuse 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