NewWe open-sourced 50+ Laravel packages
Custom AI apps, agents and automation — Roundly ConsultingRoundly
All packages
Approvals for Laravel

Blade directives

Three conditional directives ship with the package:

@approved($deployment, $user) Approved by you @endapproved
@rejected($deployment, $user) You rejected this @endrejected
@pendingApproval($deployment) Awaiting a decision @endpendingApproval
DirectiveTrue when
@approved($approvable, $actor)The actor holds an approval of the approvable that is still in force.
@rejected($approvable, $actor)The actor holds a rejection for the approvable.
@pendingApproval($approvable)The approvable has any pending decision not yet past its deadline.

They are registered with Blade::if(), so the usual @else branch and the @unless form — @unlessapproved($deployment, $user) … @endapproved — work too:

@approved($post, auth()->user())
    <span class="badge">You approved this</span>
@else
    <button type="submit">Approve</button>
@endapproved

They accept full Eloquent models, not ids, and don’t need the HasApprovals trait. If your app already registers a directive with one of these names, the package leaves yours untouched.

The same checks in PHP

The facade runs the same checks the directives use — the class behind both is internal, so go through the facade:

use RoundlyConsulting\Approvals\Facades\Approvals;

Approvals::for($deployment)->as($user)->isApproved();   // bool — @approved
Approvals::for($deployment)->as($user)->isRejected();   // bool — @rejected
Approvals::for($deployment)->hasPending();              // bool — @pendingApproval

Show your open-source love

This package is free and MIT-licensed. If it saves you time, a one-off donation or a Patreon membership keeps it maintained, tested and documented.

More ways to support, including crypto

By donating, you agree to our donation terms.

Want this built into your product?

We integrate our packages into custom Laravel and AI builds. Tell us what you're working on and we'll reply within 48 hours.