Skip to content

Revisions Pro Feature

Boxes lets the user take fine-grained control over the publishing process of their content. This is achieved by creating a revision for every change that is made to a page and letting the user decide when to publish a revision.

The revision system is disabled by default and can be enabled in the backend settings. We recommend enabling it only in production environments, as it can lead to a lot of data being stored in the database during development.

Workflow

When a user creates a new page, a new revision is created automatically. This revision is marked as draft and is not visible to the public.

The user now works on that draft until they are happy with the result. Once they are, they can publish the revision and make it available to the public.

The user can now proceed to edit the draft and publish it as needed.

Visibility

  • Logged-in users will always see the latest draft of every page.
  • Users without a backend account will see the latest published version of a page.

History and restoring revisions

The user can view the history of a page and restore any revision at any time.

The list of revisions is available in the Revisions tab of the Boxes Editor.

Cleanup

Boxes will automatically delete old revisions when new revisions are created.

By default, the last 20 revisions and all data from the last 14 days is always kept. You can change this behaviour in the backend settings.

API

The revisions feature does provide you with the following API. Please note, that any query on the Page model will by default return an unfiltered list of revisions (it does not filter by any draft or published state).

php

// The latest version of all pages, depending on the user's session.
// (logged in as admin = draft, not logged in = published)
Page::current()->get();

// Returns the latest published version of all pages.
Page::currentPublished()->get();

// Returns the latest draft version of all pages.
Page::currentDrafts()->get();