All packages
Requests for Laravel
Delegated approvers
An approver on leave can hand their authority to a stand-in through the approvals engine:
use RoundlyConsulting\Approvals\Facades\Approvals;
Approvals::delegations($alice)->to($bob)->until(now()->addWeek())->grant();
// or: $alice->delegateApprovalsTo($bob, until: now()->addWeek());
// While the delegation is active, Bob's decision counts as Alice's:
Requests::approve($request, $bob);While the delegation is active, Requests::approve($request, $bob) counts as Alice’s decision.
Delegation windows
Set the window with from(), until() or for() — nothing is written until grant(), and without a window the delegation is open-ended. Revoke it when it is no longer needed:
use RoundlyConsulting\Approvals\Facades\Approvals;
Approvals::delegations($alice)->to($bob)->grant(); // open-ended
Approvals::delegations($alice)->to($bob)->from(now()->addDay())->until(now()->addWeeks(2))->grant();
Approvals::delegations($alice)->to($bob)->for(3600)->grant(); // seconds from the start
Approvals::delegations($alice)->revoke($bob); // revoke delegations to Bob
Approvals::delegations($alice)->revoke(); // revoke all active delegations — returns the countShow 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 cryptoBy 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.