---
title: "Blade directives — Approvals for Laravel | Roundly"
description: "@approved, @rejected and @pendingApproval conditionals for your views — they work with any model, trait or not."
url: https://roundly-consulting.com/open-source/docs/approvals-for-laravel/blade-directives
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)

# Blade directives

Three conditional directives ship with the package:

```blade
@approved($deployment, $user) Approved by you @endapproved
@rejected($deployment, $user) You rejected this @endrejected
@pendingApproval($deployment) Awaiting a decision @endpendingApproval
```

| Directive | True 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:

```blade
@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:

```php
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](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)
