afiqiqmal/approval-laravel

approval-laravel
3,390 4
Install
composer require afiqiqmal/approval-laravel
Latest Version:2.0.0
PHP:^8.2
Laravel:10 · 11 · 12
License:MIT
Last Updated:May 30, 2025
Links: GitHub  ·  Packagist
Maintainer: afiqiqmal

Approval Laravel

Latest Version on Packagist Total Downloads Donate

Installation

You can install the package via composer:

composer require afiqiqmal/approval-laravel

You can publish and run the migrations with:

php artisan vendor:publish --provider="Afiqiqmal\Approval\ApprovalServiceProvider" --tag="migrations"
php artisan migrate

You can publish the config file with:

php artisan vendor:publish --provider="Afiqiqmal\Approval\ApprovalServiceProvider" --tag="config"

Usage

Add RequireApproval trait to the model
class Entity extends Model
{
    use RequireApproval;

    //plenty of public function can be customize
}
Add HasApprovable trait to the User Model
class User extends Authenticable
{
    use HasApprovable;
    //...
    //...
}
Query

Include all items including not approve

Model::getQuery()->includeNotApprove()->get(); 

List all items with not approve

Model::getQuery()->onlyNotApprove()->get(); 

Approve and Reject Item

$item = Model::first();
$item->approve()->approve($remarks); // optional remarks
$item->approve()->reject($remarks); // optional remarks

Vice versa to get the approval model

$approval = Approval::first();

$approval->approvable; // Get model

Changelog

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

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

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

Related Packages

doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database s...

641,106,524 9,700
laravel/framework

The Laravel Framework.

593,882,149 34,959
laravel/tinker

Powerful REPL for the Laravel framework.

502,645,077 7,441
laravel/serializable-closure

Laravel Serializable Closure provides an easy and secure way to serialize closur...

418,291,778 609
nunomaduro/collision

Cli error handling for console/command-line PHP applications.

394,964,158 4,660

Version History

Version Released PHP Laravel License
2.0.0 ^8.2 ^10 || ^11 || ^12 MIT
1.6.0 ^7.4|^8.0 ^6 || ^7 || ^8 || ^9 || ^10 || ^11 MIT
1.5.0 ^7.4|^8.0 ^6 || ^7 || ^8 || ^9 MIT
1.4.0 ^7.4|^8.0 ^6 || ^7 || ^8 MIT
1.3.4 ^7.4|^8.0 ^6 || ^7 || ^8 MIT