lloricode/filament-spatie-laravel-permission-plugin

Spatie Laravel permission inside of Filament.
24,623 1
Install
composer require lloricode/filament-spatie-laravel-permission-plugin
Latest Version:v2.2.3
PHP:^8.3
License:MIT
Last Updated:Jul 20, 2026
Links: GitHub  ·  Packagist
Maintainer: lloricode

Filament spatie laravel permission plugin

Latest Version on Packagist GitHub Tests Action Status Total Downloads codecov

Requirements

Pre-requisite

To be able to use this package, you need to have spatie/laravel-permission v6.9+ installed. Then follow the installation guide of spatie/laravel-permission.

This has used a wildcard permission based. So you must to set this on your config/permission.php file, else it will throw an exception Please enable wildcard permission in your config/permission.php.

// config/permission.php
'enable_wildcard_permission' => true,

Installation

You can install the package via composer:

composer require lloricode/filament-spatie-laravel-permission-plugin

You can publish the config file with:

php artisan vendor:publish --tag="filament-permission-config"

This is the contents of the published config file:

https://github.com/lloricode/filament-spatie-laravel-permission-plugin/blob/main/config/filament-permission.php

Usage

use Lloricode\FilamentSpatieLaravelPermissionPlugin\FilamentPermissionPlugin;

->plugins([
    FilamentPermissionPlugin::make(),
])

Setting up user model

// ...
use Lloricode\FilamentSpatieLaravelPermissionPlugin\Concern\PermissionUser;
use Lloricode\FilamentSpatieLaravelPermissionPlugin\Contracts\HasPermissionUser;

class Admin extends Authenticatable implements HasPermissionUser // ...
{
    use PermissionUser;
// ...

Setting up Filament pages

// ...
use Lloricode\FilamentSpatieLaravelPermissionPlugin\Concern\PermissionPages;
use Lloricode\FilamentSpatieLaravelPermissionPlugin\Contracts\HasPermissionPages;

class MyPage extends Page implements HasPermissionPages
{
    use PermissionPages;
// ...

Setting up Filament widgets

// ...
use Lloricode\FilamentSpatieLaravelPermissionPlugin\Concern\PermissionWidgets;
use Lloricode\FilamentSpatieLaravelPermissionPlugin\Contracts\HasPermissionWidgets;

class MyWidget extends ChartWidget implements HasPermissionWidgets
{
    use PermissionWidgets;
// ...

Finally, run this command to generate the permission.

php artisan permission:sync

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

Related Packages

reliese/laravel

Reliese Components for Laravel Framework code generation.

3,954,390 1,705
php-tmdb/laravel

Laravel Package for TMDB ( The Movie Database ) API. Provides easy access to the...

53,312 160
laravel-ja/laravel

The Laravel Framework.

5,667 17
kavenegar/laravel

laravel 4 and 5 kavenegar integration

366,462 86
laravel/laravel

The skeleton application for the Laravel framework.

64,738,171 84,935