Content approval system for Laravel. Works just like Laravel's own soft deleting system.
PHP >= 5.5
Step 1: Add the following line to your composer.json
's require
array.
"hkan/approval": "dev-master"
Step 2: Add is_approved
column to your desired models' tables (Recommended migration line)
$table->boolean('is_approved')->default(false);
Step 3: Copy the following line to the providers
array of app/config/app.php
'Hkan\Approval\ApprovalServiceProvider'
Step 4: Add the trait to your model(s).
use \Hkan\Approval\Traits\ApprovalTrait;
$post->approve()
$post->unapprove()
Post::all() // Only approved posts
Post::onlyUnapproved()->get() // Only unapproved posts
Post::withUnapproved()->get() // Both approved and unapproved posts
Issues, pull requests and feature requests are welcome.