Search by

roundly-consulting / approvals-for-laravel

mihaliak

Record polymorphic approvals between Eloquent models for Laravel.

Package info

github.com/roundly-consulting/approvals-for-laravel

pkg:composer/roundly-consulting/approvals-for-laravel

Fund package maintenance!

Patreon

Statistics

Installs: 47

Dependents: 7

Suggesters: 0

Stars: 0

Open Issues: 0

1.0.0 2026-10-03 17:54 UTC

This package is auto-updated.

Last update: 2026-10-03 18:03:31 UTC


README

Approvals for Laravel — Roundly open source

Latest release Tests Code style Donate Patreon Crypto

Approvals for Laravel

Model approvals, rejections, and multi-approver sign-off between Eloquent models. Any model can decide on any other, and a subject can open a request that resolves by unanimous, quorum, any-one or weighted rules — as staged pipelines, with delegation, expiry and an event for every transition.

Installation

Requires PHP 8.4 and Laravel 12 or 13.

composer require roundly-consulting/approvals-for-laravel
php artisan vendor:publish --tag="approvals-migrations"
php artisan migrate

If your models have UUID/ULID keys, set APPROVALS_KEY_TYPE=uuid (or ulid) before migrating.

Usage

Give the deciding model and the decided-on model their traits:

use Illuminate\Database\Eloquent\Model;
use RoundlyConsulting\Approvals\Traits\GivesApprovals;
use RoundlyConsulting\Approvals\Traits\HasApprovals;
use RoundlyConsulting\Approvals\Traits\RequiresApproval;

class User extends Model
{
    use GivesApprovals;
}

class Invoice extends Model
{
    use HasApprovals;
    use RequiresApproval;
}

Then open a request that needs two of three named approvers — it resolves as their decisions come in:

use RoundlyConsulting\Approvals\Facades\Approvals;

Approvals::request($invoice)->from([$lead, $qa, $pm])->quorum(2)->open();

Approvals::for($invoice)->as($lead)->approve();
Approvals::status($invoice);                      // ApprovalStatus::Pending — 1 of 2

Approvals::for($invoice)->as($intern)->approve(); // throws UnauthorizedApprovalException: not named

Approvals::for($invoice)->as($qa)->because('Totals check out')->approve();
Approvals::status($invoice);                      // ApprovalStatus::Approved
$invoice->isApproved();                           // true

Documentation

The full documentation — configuration, every feature and its API, and testing — lives on our website: roundly-consulting.com/open-source/docs/approvals-for-laravel

Release notes are in CHANGELOG.md. To contribute, see the contributing guide.

Support our work

This package is free and open source, built and maintained by Roundly Consulting. If it saves you time, please consider supporting our open-source work — a one-time donation, a monthly pledge on Patreon or a crypto donation helps fund maintenance, new features and new packages.

Donate to Roundly open source Become a patron on Patreon Donate crypto: BTC, ETH, BNB or SOL

License

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