hkan / approval
Installs: 20
Dependents: 0
Suggesters: 0
Security: 0
Stars: 5
Watchers: 3
Forks: 1
Open Issues: 0
pkg:composer/hkan/approval
Requires
- php: >=5.5.0
- illuminate/database: 4.2.*
- illuminate/support: 4.2.*
Requires (Dev)
- mockery/mockery: ~0.9.2
- phpunit/phpunit: 3.*
This package is auto-updated.
Last update: 2021-04-16 07:37:12 UTC
README
Content approval system for Laravel. Works just like Laravel's own soft deleting system.
Requirements
PHP >= 5.5
Installation
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;
Usage
Approve and unapprove posts
$post->approve()
$post->unapprove()
Approved and unapproved posts
Post::all() // Only approved posts
Post::onlyUnapproved()->get() // Only unapproved posts
Post::withUnapproved()->get() // Both approved and unapproved posts
Contribution
Issues, pull requests and feature requests are welcome.