PHP code example of lloricode / filament-spatie-laravel-permission-plugin

1. Go to this page and download the library: Download lloricode/filament-spatie-laravel-permission-plugin library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

lloricode / filament-spatie-laravel-permission-plugin example snippets


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

use Lloricode\FilamentSpatieLaravelPermissionPlugin\FilamentPermissionPlugin;

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

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

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

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

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

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

class MyWidget extends ChartWidget implements HasPermissionWidgets
{
    use PermissionWidgets;
// ...
bash
php artisan vendor:publish --tag="filament-permission-config"
bash
php artisan permission:sync