---
title: "DI and actions — Approvals for Laravel | Roundly"
description: "Skip the facade: inject ApprovalsManager or call the action classes directly — with the complete facade-method-to-action map."
url: https://roundly-consulting.com/open-source/docs/approvals-for-laravel/without-facade
language: en
---

[All packages](https://roundly-consulting.com/open-source.md)

[Approvals for Laravel](https://roundly-consulting.com/open-source/docs/approvals-for-laravel.md)

# DI and actions

There are three equivalent entry points, and all of them run the same code:

- The Approvals facade — the shortest form and the recommended default.
- The manager, RoundlyConsulting\\Approvals\\ApprovalsManager — the facade root. Inject it through the constructor for the same API as an explicit dependency, with no static calls.
- Actions in RoundlyConsulting\\Approvals\\Actions — single-purpose classes with execute(), for composing into your own actions, jobs and commands.

## Injecting the manager

```php
use RoundlyConsulting\Approvals\ApprovalsManager;

final class ApproveInvoice
{
    public function __construct(private ApprovalsManager $approvals) {}

    public function __invoke(Invoice $invoice, User $user): void
    {
        $this->approvals->for($invoice)->as($user)->approve();
    }
}
```

Approvals::fake() swaps in a subtype of ApprovalsManager for the facade and for injected managers alike, so code written this way is recorded in tests too.

## Calling an action

```php
use RoundlyConsulting\Approvals\Actions\ApproveAction;
use RoundlyConsulting\Approvals\Actions\OpenApprovalRequestAction;
use RoundlyConsulting\Approvals\DataTransferObjects\ApprovalRequestData;
use RoundlyConsulting\Approvals\DataTransferObjects\DecisionData;
use RoundlyConsulting\Approvals\Enums\ApprovalRule;

app(OpenApprovalRequestAction::class)->execute(
    new ApprovalRequestData($invoice, [$a, $b, $c], ApprovalRule::Quorum, quorum: 2),
);

app(ApproveAction::class)->execute($user, $invoice, DecisionData::approved('LGTM'));
```

The manager resolves every action from the container too, so a binding you register for an action applies to the facade path as well.

## Facade method → action

| Action | Facade path |
| --- | --- |
| `ApproveAction` | `for()->as()->approve()` |
| `RejectAction` | `for()->as()->reject()` |
| `RequestApprovalAction` | `for()->as()->ask()` |
| `CancelApprovalAction` | `for()->as()->cancel()` |
| `ToggleApprovalAction` | `for()->as()->toggle()` |
| `OpenApprovalRequestAction` | `request()->from()->open()` |
| `RequestStagedApprovalAction` | `request()->stages()->open()` |
| `OpenWorkflowRequestAction` | `request()->workflow()->open()` |
| `DelegateApprovalsAction` | `delegations()->to()->grant()` |
| `RevokeApprovalDelegationAction` | `delegations()->revoke()` |
| `ExpireApprovalsAction` | `expire()` |
| `CloseApprovalRequestAction` | `for()->close()` |

Every execute() signature and the DTOs the actions take are listed under Actions & DTOs.

## 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](https://roundly-consulting.com/support-us.md)

By donating, you agree to our [donation terms](https://roundly-consulting.com/donation-terms.md).

[Support our open source work (opens in a new tab)](https://donate.stripe.com/dRmeVe8FX5PF1Qd9pXcEw00) [Join us on Patreon (opens in a new tab)](https://www.patreon.com/cw/roundly)

## 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.

[Get a quote in 48 hours](https://roundly-consulting.com/contact.md) [Browse all packages](https://roundly-consulting.com/open-source/docs/approvals-for-laravel.md)
