Easily add an approval process to any laravel model
Via Composer
$ composer require victorlap/laravel-approvable
Next, you must install the service provider:
// config/app.php
'providers' => [
...
Victorlap\Approvable\ApprovableServiceProvider::class,
];
You can publish the migration with:
php artisan vendor:publish --provider="Victorlap\Approvable\ApprovableServiceProvider" --tag="migrations"
Note: The default migration assumes you are using integers for your model IDs. If you are using UUIDs, or some other format, adjust the format of the approvable_id and user_id fields in the published migration before continuing.
After the migration has been published you can create the approvals
table by running the migrations:
php artisan migrate
- Add the trait to your eloquent model.
- (Optional) Specify the
approveOf
ordontApproveOf
array to skip certain fields.
use Illuminate\Database\Eloquent\Model;
use Victorlap\Approvable\Approvable;
class User extends Model
{
use Aprrovable;
protected $approveOf = array();
protected $dontApproveOf = array();
}
Please see CHANGELOG for more information on what has changed recently.
$ composer test
Please see CONTRIBUTING and CONDUCT for details.
If you discover any security related issues, please email victorlap@outlook.com instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.