2017 © Pedro Peláez
 

library drafterer

Drafting upcoming versions for Eloquent models

image

glaivepro/drafterer

Drafting upcoming versions for Eloquent models

  • Tuesday, June 26, 2018
  • by tontonsb
  • Repository
  • 1 Watchers
  • 0 Stars
  • 1 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

Drafterer

The development of this package is a bit postponed for now because of lack of time., (*1)

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., (*2)

Install

Via Composer. ``` bash $ composer require glaivepro/drafterer, (*3)


Afterwards you should migrate the table for drafts. Just do it. ``` bash $ php artisan migrate

Usage

Make your model draftable. ``` php use Illuminate\Database\Eloquent\Model; use GlaivePro\Drafterer\Draftable;, (*4)

class Article extends Model { use Draftable; // }, (*5)


Save changes as a draft instead of the model itself. ``` php $article = Article::find(1); $article->title = 'Real title'; $article->intro = 'Real introduction'; $article->save(); $article->title = 'Draft title'; $article->drafterer->save();

Use the real or drafted article. ``` php $article = Article::find(1);, (*6)

$article->title; // returns 'Real title', (*7)

$article->drafterer->title; // returns 'Draft title' $article->drafterer->intro; // returns 'Real introduction', (*8)


You might want to decide to use the draft as the real version - just write it down then. ``` php $article->drafterer->write();

Or you might discard it. ``` php $article->drafterer->discard();, (*9)


For draft-only users or conditionals we can also replace the attributes with the drafted ones. ``` php $article->title; // returns 'Real title' $article->drafterer->load(); $article->title; // returns 'Draft title'

Change log

Please see CHANGELOG for more information on what has changed recently., (*10)

Security

If you discover any security related issues, please email juris@glaive.pro instead of using the issue tracker., (*11)

License

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

The Versions

26/06 2018

dev-master

9999999-dev https://github.com/GlaivePro/Drafterer

Drafting upcoming versions for Eloquent models

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel eloquent

26/06 2018

0.1.2

0.1.2.0 https://github.com/GlaivePro/Drafterer

Drafting upcoming versions for Eloquent models

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel eloquent

26/06 2018

0.1.0

0.1.0.0 https://github.com/GlaivePro/Drafterer

Drafting upcoming versions for Eloquent models

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel eloquent

26/06 2018

0.1.1

0.1.1.0 https://github.com/GlaivePro/Drafterer

Drafting upcoming versions for Eloquent models

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel eloquent