-
-
Notifications
You must be signed in to change notification settings - Fork 3
Preview Revision
Muah edited this page Mar 20, 2018
·
5 revisions
note that if you don't need this feature, no changes is required, just follow the default usage steps and you are done.
there are only a couple of extra steps that needs to be made to get this to work.
-
add a new
template
param to theinclude
declaration.-
the template path is relative to
views
, for exampleviews/posts/preview
. -
the template name could be anything you want, this is just a place to send the revision data to.
@if (count($post->revisions)) @include('Odin::list', [ 'revisions' => $post->revisions, 'template' => 'posts.preview' ]) @endif
-
-
the returned payload variable is
$data
, so inside the preview file call any property as usual like{{ $data->cover }} {{ $data->title }} {{ $data->body }} // etc...
- don't try to edit the returned payload directly as it could lead to some side effects.
- any operations to the revision should be done through the main view, that's why we automaticlly open the preview in a new tab so you can just switch the tab and continue from where you left.