PHPackages                             httpfactory/approvals - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. httpfactory/approvals

ActiveLibrary[Testing &amp; Quality](/categories/testing)

httpfactory/approvals
=====================

Approvals Package

0.1.0(7y ago)067PHP

Since Dec 6Pushed 7y ago1 watchersCompare

[ Source](https://github.com/iamjaime/approvals)[ Packagist](https://packagist.org/packages/httpfactory/approvals)[ RSS](/packages/httpfactory-approvals/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (3)Used By (0)

### Approval System

[](#approval-system)

The approval system package is an add-on package that allows seamless integration into laravel 5.7+

#### Installation

[](#installation)

To install simply pull in the package to your laravel project
`composer install httpfactory\approvals`

After you have successfully installed it via composer, you will need to
register the package in your `config\app.php` file.

Add the following line to your service providers array :
`Httpfactory\Approvals\ApprovalServiceProvider::class`

Now you need to run the following command :
`php artisan vendor:publish --provider=Httpfactory\Approvals\ApprovalServiceProvider`

After registering the package, you will need to run migrations

#### Run The Migrations

[](#run-the-migrations)

you must run your migrations as follows
`php artisan migrate`

#### Events

[](#events)

You will need to add the following events to the `app\Providers\EventServiceProvider.php`

- ApprovalRequest

    - `Httpfactory\Approvals\Events\ApprovalRequest`
    - Fires when someone sends an approval request.
- ApprovalApproved

    - `Httpfactory\Approvals\Events\ApprovalApproved`
    - Fires when an "approver" approves the approval request.
- ApprovalDeclined

    - `Httpfactory\Approvals\Events\ApprovalDeclined`
    - Fires when an "approver" declines the approval request.
- ApprovalAwarded

    - `Httpfactory\Approvals\Events\ApprovalAwarded`
    - Fires when the approval configuration requirements are met and the approval is automatically awarded.
- ApprovalDenied

    - `Httpfactory\Approvals\Events\ApprovalDenied`
    - Fires when the approval configuration requirements are met and the approval is automatically denied.

The Events should look something like the code below

```
           //Begin the approval events
           'Httpfactory\Approvals\Events\ApprovalRequest' => [
               'Httpfactory\Approvals\Listeners\ApprovalRequest',
           ],

           'Httpfactory\Approvals\Events\ApprovalApproved' => [
               'Httpfactory\Approvals\Listeners\ApprovalApproved',
           ],

           'Httpfactory\Approvals\Events\ApprovalDeclined' => [
               'Httpfactory\Approvals\Listeners\ApprovalDeclined',
           ],

           'Httpfactory\Approvals\Events\ApprovalAwarded' => [
               'Httpfactory\Approvals\Listeners\ApprovalAwarded',
           ],

           'Httpfactory\Approvals\Events\ApprovalDenied' => [
               'Httpfactory\Approvals\Listeners\ApprovalDenied',
           ],

```

#### Usage

[](#usage)

There are multiple types of approvals :

1. Quick Approval ( 1 to 1 )
2. Group Approval ( a group of users must approve/deny )
3. MultiTier Approval ( multiple groups must approve/deny )

#### Quick Approval

[](#quick-approval)

Below is an example of a quick approval :

```
