PHPackages                             maheralmatari/shield - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. maheralmatari/shield

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

maheralmatari/shield
====================

Filament support for `spatie/laravel-permission`.

v01(3y ago)16MITPHPPHP ^8.0|^8.1

Since Aug 10Pushed 1y agoCompare

[ Source](https://github.com/almatari1/shield)[ Packagist](https://packagist.org/packages/maheralmatari/shield)[ Docs](https://github.com/almatari1/shield)[ GitHub Sponsors](https://github.com/MaherAlmatari)[ RSS](/packages/maheralmatari-shield/feed)WikiDiscussions main Synced 6d ago

READMEChangelog (1)Dependencies (16)Versions (2)Used By (0)

[![filament-shield-art](https://user-images.githubusercontent.com/10007504/148662315-35d4bd74-fc1c-4f8c-8c02-689309b414b0.png)](https://github.com/MaherAlmatari/filament-shield) [ ![FILAMENT 8.x](https://camo.githubusercontent.com/c98f15eb6bb59ce4fc768808e21fd46a07d238312928102f3d7ad4bed7c31f70/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f46494c414d454e542d322e782d4542423330343f7374796c653d666f722d7468652d6261646765) ](https://filamentadmin.com/docs/2.x/admin/installation) [ ![Packagist](https://camo.githubusercontent.com/188688449804ffcc18ad72fcaed515e7228df8494bbbc197e52cccf5757f7716/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f4d61686572416c6d61746172692f66696c616d656e742d736869656c642e7376673f7374796c653d666f722d7468652d6261646765266c6f676f3d7061636b6167697374) ](https://packagist.org/packages/MaherAlmatari/filament-shield) [ ![Tests Passing](https://camo.githubusercontent.com/86c5dbc8aaa038fbc309b5129390c30b42997f60a695f15401f27ff8cf7f447c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f4d61686572416c6d61746172692f66696c616d656e742d736869656c642f72756e2d74657374733f7374796c653d666f722d7468652d6261646765266c6f676f3d676974687562266c6162656c3d7465737473) ](https://github.com/MaherAlmatari/filament-shield/actions?query=workflow%3Arun-tests+branch%3Amain) [ ![Code Style Passing](https://camo.githubusercontent.com/cdc0b7a56e251e6f816c027135d2adb134cdee9b6c12f77937094b347c993c08/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f4d61686572416c6d61746172692f66696c616d656e742d736869656c642f72756e2d74657374733f7374796c653d666f722d7468652d6261646765266c6f676f3d676974687562266c6162656c3d636f64652532307374796c65) ](https://github.com/MaherAlmatari/filament-shield/actions?query=workflow%3A)[ ![Downloads](https://camo.githubusercontent.com/c895f772233c2d045bc44756e8a9266338486ec9fd83461e0a4d45f0f23dfe16/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f4d61686572416c6d61746172692f66696c616d656e742d736869656c642e7376673f7374796c653d666f722d7468652d6261646765) ](https://packagist.org/packages/MaherAlmatari/filament-shield)

---

Filament Shield
===============

[](#filament-shield)

The easiest and most intuitive way to add access management to your Filament Admin:

- 🔥 **Resources**
- 🔥 **Pages**
- 🔥 **Widgets**
- 🔥 **Custome Permission**

Upgrade
-------

[](#upgrade)

To upgrade to the latest release first run:

```
composer update
```

#### v2.x

[](#v2x)

> **Note**Minimum **Filament** Requirement is now `2.13`.

**Before following along, backup your current `config` first.**

1. Upgrade from **`1.x`**

    1. Delete `Shield` folder from `App\Filament\Resources`
    2. Delete `filament-shield` from `resources\lang\vendor or lang\vendor`
    3. Delete `filament-shield` from `resources\views\vendor`
    4. Delete `filament-shield.php` from `Config`
    5. Now either follow **`Upgrade only`**
2. **Upgrade only**

    1. Publish the `Config`:

        ```
        php artisan vendor:publish --tag=filament-shield-config --force
        ```
    2. Configure: Update the new **`published config`** based on your **`backed-up config`**
    3. Install:

        ```
        php artisan shield:upgrade
        ```

> **Note**for **Filament** prior to 2.13 use [v1.1.12](https://github.com/MaherAlmatari/filament-shield/releases/tag/v1.1.12)

Installation
------------

[](#installation)

1. Install the package via composer:

```
composer require MaherAlmatari/filament-shield
```

2. Add the `Spatie\Permission\Traits\HasRoles` trait to your User model(s):

```
use Illuminate\Foundation\Auth\User as Authenticatable;
use Spatie\Permission\Traits\HasRoles;

class User extends Authenticatable
{
    use HasRoles; //or HasFilamentShield

    // ...
}
```

3. Publish the `config` using:

```
php artisan vendor:publish --tag=filament-shield-config
```

4. Setup your configuration

```
