This package is abandoned and no longer maintained. No replacement package was suggested.

Drafting upcoming versions for Eloquent models

0.1.2 2018-06-26 17:46 UTC

This package is auto-updated.

Last update: 2020-10-07 07:16:54 UTC


The development of this package is a bit postponed for now because of lack of time.

Drafterer is a Laravel package that allows you to save a draft version of an Eloquent model. It can be used for previewing upcoming changes before commiting them. Also useful for autosaved version.


Via Composer.

$ composer require glaivepro/drafterer

Afterwards you should migrate the table for drafts. Just do it.

$ php artisan migrate


Make your model draftable.

use Illuminate\Database\Eloquent\Model;
use GlaivePro\Drafterer\Draftable;

class Article extends Model
    use Draftable;

Save changes as a draft instead of the model itself.

$article = Article::find(1);
$article->title = 'Real title';
$article->intro = 'Real introduction';

$article->title = 'Draft title';

Use the real or drafted article.

$article = Article::find(1);

$article->title;  // returns 'Real title'

$article->drafterer->title; // returns 'Draft title'
$article->drafterer->intro; // returns 'Real introduction'

You might want to decide to use the draft as the real version - just write it down then.


Or you might discard it.


For draft-only users or conditionals we can also replace the attributes with the drafted ones.

$article->title;  // returns 'Real title'


$article->title;  // returns 'Draft title'

Change log

Please see CHANGELOG for more information on what has changed recently.


If you discover any security related issues, please email instead of using the issue tracker.


The MIT License (MIT). Please see License File for more information.