Skip to content
This repository has been archived by the owner on Mar 1, 2022. It is now read-only.

Easily add an approval process to any laravel model.

License

Notifications You must be signed in to change notification settings

victorlap/laravel-approvable

Repository files navigation

Laravel Approvable

Latest Version on Packagist Software License Build Status Coverage Status Quality Score StyleCI Total Downloads

Easily add an approval process to any laravel model

Install

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

Usage

  1. Add the trait to your eloquent model.
  2. (Optional) Specify the approveOf or dontApproveOf array to skip certain fields.

Example

use Illuminate\Database\Eloquent\Model;
use Victorlap\Approvable\Approvable;

class User extends Model
{
    use Aprrovable;

    protected $approveOf = array();

    protected $dontApproveOf = array();
}

Change log

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

Testing

$ composer test

Contributing

Please see CONTRIBUTING and CONDUCT for details.

Security

If you discover any security related issues, please email victorlap@outlook.com instead of using the issue tracker.

Credits

License

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