{"id":13732988,"url":"https://github.com/bezhanSalleh/filament-shield","last_synced_at":"2025-05-08T09:31:22.720Z","repository":{"id":37441430,"uuid":"443775406","full_name":"bezhanSalleh/filament-shield","owner":"bezhanSalleh","description":"The easiest and most intuitive way to add access management to your Filament Admin Resources, Pages \u0026 Widgets through `spatie/laravel-permission`","archived":false,"fork":false,"pushed_at":"2024-10-02T20:24:00.000Z","size":740,"stargazers_count":1675,"open_issues_count":4,"forks_count":186,"subscribers_count":18,"default_branch":"3.x","last_synced_at":"2024-10-29T15:24:15.114Z","etag":null,"topics":["acl","easy-access-management","filament","filamentplugin","laravel","livewire","permissions","php","roles","secure"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bezhanSalleh.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"bezhanSalleh"}},"created_at":"2022-01-02T13:40:00.000Z","updated_at":"2024-10-29T07:19:20.000Z","dependencies_parsed_at":"2024-01-12T08:37:00.333Z","dependency_job_id":"5a1a2ed1-f3c6-40f2-b1f1-11c308a19a36","html_url":"https://github.com/bezhanSalleh/filament-shield","commit_stats":{"total_commits":518,"total_committers":79,"mean_commits":6.556962025316456,"dds":0.5444015444015444,"last_synced_commit":"937072f1d671fff02dd273c8f43b632f36fa3c9d"},"previous_names":[],"tags_count":86,"template":false,"template_full_name":"spatie/package-skeleton-laravel","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bezhanSalleh%2Ffilament-shield","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bezhanSalleh%2Ffilament-shield/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bezhanSalleh%2Ffilament-shield/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bezhanSalleh%2Ffilament-shield/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bezhanSalleh","download_url":"https://codeload.github.com/bezhanSalleh/filament-shield/tar.gz/refs/heads/3.x","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224717509,"owners_count":17357897,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["acl","easy-access-management","filament","filamentplugin","laravel","livewire","permissions","php","roles","secure"],"created_at":"2024-08-03T03:00:36.381Z","updated_at":"2025-05-08T09:31:22.691Z","avatar_url":"https://github.com/bezhanSalleh.png","language":"PHP","funding_links":["https://github.com/sponsors/bezhanSalleh"],"categories":["Plugins","Login","Integrations"],"sub_categories":["Administration \u0026 Management"],"readme":"\u003ca href=\"https://github.com/bezhansalleh/filament-shield\" class=\"filament-hidden\"\u003e\n\u003cimg style=\"width: 100%; max-width: 100%;\" alt=\"filament-shield-art\" src=\"https://user-images.githubusercontent.com/10007504/148662315-35d4bd74-fc1c-4f8c-8c02-689309b414b0.png\" \u003e\n\u003c/a\u003e\n\n\u003cp align=\"center\" class=\"flex items-center justify-center\"\u003e\n    \u003ca href=\"https://filamentadmin.com/docs/2.x/admin/installation\"\u003e\n        \u003cimg alt=\"FILAMENT 8.x\" src=\"https://img.shields.io/badge/FILAMENT-3.x-EBB304?style=for-the-badge\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://packagist.org/packages/bezhansalleh/filament-shield\"\u003e\n        \u003cimg alt=\"Packagist\" src=\"https://img.shields.io/packagist/v/bezhansalleh/filament-shield.svg?style=for-the-badge\u0026logo=packagist\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/bezhansalleh/filament-shield/actions?query=workflow%3Arun-tests+branch%3A3.x\"\u003e\n        \u003cimg alt=\"Tests Passing\" src=\"https://img.shields.io/github/actions/workflow/status/bezhansalleh/filament-shield/run-tests.yml?style=for-the-badge\u0026logo=github\u0026label=tests\" class=\"filament-hidden\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/bezhansalleh/filament-shield/actions?query=workflow%3A\"Check+%26+fix+styling\"+branch%3A3.x\" class=\"filament-hidden\"\u003e\n        \u003cimg alt=\"Code Style Passing\" src=\"https://img.shields.io/github/actions/workflow/status/bezhansalleh/filament-shield/laravel-pint.yml?style=for-the-badge\u0026logo=github\u0026label=code%20style\"\u003e\n    \u003c/a\u003e\n\n\u003ca href=\"https://packagist.org/packages/bezhansalleh/filament-shield\"\u003e\n    \u003cimg alt=\"Downloads\" src=\"https://img.shields.io/packagist/dt/bezhansalleh/filament-shield.svg?style=for-the-badge\" \u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\n# Shield\n\nThe easiest and most intuitive way to add access management to your Filament Panels.\n\n## Features\n\n- 🛡️ **Complete Authorization Management**\n  - Resource Permissions\n  - Page Permissions\n  - Widget Permissions\n  - Custom Permissions\n- 🔄 **Multi-tenancy Support**\n- 🚀 **Easy Setup \u0026 Configuration**\n- 🎨 **Best UI**\n- 📦 **Policy Generation**\n- 🌐 **Translations Support**\n\n## Requirements\n\n- PHP 8.1 | 8.2 | 8.3\n- Laravel v10.x | v11.x\n- Filament v3.2+\n- Spatie Permission v6.0+\n\n\u003e [!NOTE] \n\u003e For **Filament 2.x** use **[2.x](https://github.com/bezhanSalleh/filament-shield/tree/2.x)** branch\n\n\u003cdiv class=\"filament-hidden\"\u003e\n\u003cb\u003eTable of Contents\u003c/b\u003e\n\n- [Shield](#shield)\n  - [Features](#features)\n  - [Requirements](#requirements)\n  - [Installation](#installation)\n    - [1. Install Package](#1-install-package)\n    - [2. Configure Auth Provider](#2-configure-auth-provider)\n    - [3. Setup Shield](#3-setup-shield)\n    - [4. Install for Panel](#4-install-for-panel)\n  - [Usage](#usage)\n      - [Configuration](#configuration)\n      - [Resources](#resources)\n        - [Default](#default)\n        - [Custom Permissions](#custom-permissions)\n        - [Configure Permission Identifier](#configure-permission-identifier)\n        - [Custom Navigation Group](#custom-navigation-group)\n      - [Pages](#pages)\n          - [Pages Hooks](#pages-hooks)\n          - [Pages Redirect Path](#pages-redirect-path)\n      - [Widgets](#widgets)\n    - [Policies](#policies)\n      - [Path](#path)\n      - [Policy Discovery](#policy-discovery)\n        - [Using Laravel 10](#using-laravel-10)\n        - [Using Laravel 11](#using-laravel-11)\n      - [Users (Assigning Roles to Users)](#users-assigning-roles-to-users)\n      - [Layout Customization](#layout-customization)\n  - [Available Commands](#available-commands)\n    - [Prohibited Commands](#prohibited-commands)\n    - [Core Commands](#core-commands)\n    - [Generate Command Options](#generate-command-options)\n      - [Translations](#translations)\n  - [Testing](#testing)\n  - [Changelog](#changelog)\n  - [Contributing](#contributing)\n  - [Security Vulnerabilities](#security-vulnerabilities)\n  - [Credits](#credits)\n  - [License](#license)\n\u003c/div\u003e\n\n## Installation\n\n### 1. Install Package\n```bash\ncomposer require bezhansalleh/filament-shield\n```\n\n### 2. Configure Auth Provider\n#### 2.1. Publish the config and setup your auth provider model.\n```bash\nphp artisan vendor:publish --tag=\"filament-shield-config\"\n```\n```php\n//config/filament-shield.php\n...\n    'auth_provider_model' =\u003e [\n        'fqcn' =\u003e 'App\\\\Models\\\\User',\n    ],\n...\n```\n#### 2.2 Add the `HasRoles` trait to your auth provider model:\n```php\nuse Spatie\\Permission\\Traits\\HasRoles;\n\nclass User extends Authenticatable\n{\n    use HasRoles;\n}\n```\n\n### 3. Setup Shield\n3.1 **Without Tenancy:**\n```bash\nphp artisan shield:setup\n```\n\n3.2 **With Tenancy:**\n```bash\nphp artisan shield:setup --tenant=App\\\\Models\\\\Team\n# Replace Team with your tenant model\n```\n\nThis command will:\n- Publish core package config\n- Publish core package migrations\n- Run initial migrations\n- Publish shield config\n- Configure tenancy if specified\n\n### 4. Install for Panel\nThe install command will register the plugin for your panel automatically. Choose the appropriate installation method:\n\n4.1 **Without Tenancy:**\n```bash\nphp artisan shield:install admin\n# Replace 'admin' with your panel ID\n```\nOr instead of the above command you can register the plugin manually in your `xPanelProvider`:\n```php\n    -\u003eplugins([\n        \\BezhanSalleh\\FilamentShield\\FilamentShieldPlugin::make(),\n    ])\n```\n4.2 **With Tenancy:**\n```bash\nphp artisan shield:install admin --tenant --generate-relationships\n# Replace 'admin' with your panel ID\n```\nOr instead of the above command you can register the plugin and enable tenancy manually in your `xPanelProvider`:\n```php\n    -\u003etenant(YourTenantModel::class)\n    -\u003etenantMiddleware([\n        \\BezhanSalleh\\FilamentShield\\Middleware\\SyncShieldTenant::class,\n    ], isPersistent: true)\n    -\u003eplugins([\n        \\BezhanSalleh\\FilamentShield\\FilamentShieldPlugin::make(),\n    ])\n```\nThis command will:\n- Register Shield plugin for your panel\n- If `--tenant` flag is provided:\n  - Activates tenancy features \n  - Makes the panel tenantable\n  - Adds `SyncShieldTenant` middleware to the panel\n  - Configures tenant model from the config\n- If `--generate-relationships` flag is provided:\n  - Generates required relationships between resource models and the tenant model\n  - Adds necessary relationship methods in both the resource and tenant models\n\n## Usage\n\n#### Configuration\nSee [config/filament-shield.php](config/filament-shield.php) for full configuration options.\n\n#### Resources\nGenerally there are two scenarios that shield handles permissions for your `Filament` resources.\n\n##### Default\nOut of the box `Shield` handles the predefined permissions for `Filament` resources. So if that's all that you need you are all set. \nIf you need to add a single permission (for instance `lock`) and have it available for all your resources just append it to the following `config` key:\n\n```php\n    permission_prefixes' =\u003e [\n        'resource' =\u003e [\n            'view',\n            'view_any',\n            'create',\n            'update',\n            'restore',\n            'restore_any',\n            'replicate',\n            'reorder',\n            'delete',\n            'delete_any',\n            'force_delete',\n            'force_delete_any',\n            'lock'\n        ],\n        ...\n    ],\n```\n:bulb: Now you are thinking **`what if I need a permission to be only available for just one resource?`**\nNo worries, that's where [Custom Permissions](#custom-permissions) come to play.\n\n##### Custom Permissions\nTo define custom permissions per `Resource` your `Resource` must implement the `HasShieldPermissions` contract.\nThis contract has a `getPermissionPrefixes()` method which returns an array of permission prefixes for your `Resource`.\n\nConsider you have a `PostResource` and you want a couple of the predefined permissions plus a new permission called `publish_posts` to be only available for `PostResource` only.\n\n```php\n\u003c?php\n\nnamespace BezhanSalleh\\FilamentShield\\Resources;\n\nuse BezhanSalleh\\FilamentShield\\Contracts\\HasShieldPermissions;\n...\n\nclass PostResource extends Resource implements HasShieldPermissions\n{\n    ...\n\n    public static function getPermissionPrefixes(): array\n    {\n        return [\n            'view',\n            'view_any',\n            'create',\n            'update',\n            'delete',\n            'delete_any',\n            'publish'\n        ];\n    }\n\n    ...\n}\n```\nIn the above example the `getPermissionPrefixes()` method returns the permission prefixes `Shield` needs to generate the permissions.\n\n✅ Now to enforce `publish_post` permission headover to your `PostPolicy` and add a `publish()` method:\n```php\n    /**\n     * Determine whether the user can publish posts.\n     *\n     * @param  \\App\\Models\\User  $admin\n     * @return \\Illuminate\\Auth\\Access\\Response|bool\n     */\n    public function publish(User $user)\n    {\n        return $user-\u003ecan('publish_post');\n    } \n```\n🅰️/🈯️ To make the prefix translatable, publish `Shield`'s translations and append the prefix inside `resource_permission_prefixes_labels` as key and it's translation as value for the languages you need.\n```php\n//lang/en/filament-shield.php\n'resource_permission_prefixes_labels' =\u003e [\n    'publish' =\u003e 'Publish'    \n],\n//lang/es/filament-shield.php\n'resource_permission_prefixes_labels' =\u003e [\n    'publish' =\u003e 'Publicar'    \n],\n```\n\n##### Configure Permission Identifier\nBy default the permission identifier is generated as follow:\n```php\nStr::of($resource)\n    -\u003eafterLast('Resources\\\\')\n    -\u003ebefore('Resource')\n    -\u003ereplace('\\\\', '')\n    -\u003esnake()\n    -\u003ereplace('_', '::');\n```\nSo for instance if you have a resource like `App\\Filament\\Resources\\Shop\\CategoryResource` then the permission identifier would be `shop::category` and then it would be prefixed with your defined prefixes or what comes default with shield.\n\nIf you wish to change the default behaviour, then you can call the static `configurePermissionIdentifierUsing()` method inside a service provider's `boot()` method, to which you pass a Closure to modify the logic. The Closure receives the fully qualified class name of the resource as `$resource` which gives you the ability to access any property or method defined within the resource.\n\nFor example, if you wish to use the model name as the permission identifier, you can do it like so:\n\n```php\nuse BezhanSalleh\\FilamentShield\\Facades\\FilamentShield;\n\nFilamentShield::configurePermissionIdentifierUsing(\n    fn($resource) =\u003e str($resource::getModel())\n        -\u003eafterLast('\\\\')\n        -\u003elower()\n        -\u003etoString()\n);\n```\n\u003e **Warning**\n\u003e Keep in mind that ensuring the uniqueness of the permission identifier is now up to you.\n\n##### Custom Navigation Group\nBy default the english translation renders Roles and Permissions under 'Filament Shield' if you wish to change this, first publish the [translations files](#translations) and change the relative locale to the group of your choosing for example:\n\n```php\n'nav.group' =\u003e 'Filament Shield',\n```\n\nto\n\n```php\n'nav.group' =\u003e 'User Management',\n```\napply this to each language you have groups in.\n\n#### Pages\n\nIf you have generated permissions for `Pages` you can toggle the page's navigation from sidebar and restrict access to the page. You can set this up manually but this package comes with a `HasPageShield` trait to speed up this process. All you have to do is use the trait in you pages:\n```php\n\u003c?php\n\nnamespace App\\Filament\\Pages;\n\nuse ...;\nuse BezhanSalleh\\FilamentShield\\Traits\\HasPageShield;\n\nclass MyPage extends Page\n{\n    use HasPageShield;\n    ...\n}\n```\n\n📕 \u003cb style=\"color:darkred\"\u003e`HasPageShield` uses the `booted` method to check the user's permissions and makes sure to execute the `booted` page method in the parent page if exists.\u003c/b\u003e\n\n###### Pages Hooks\n\nHowever if you need to perform some methods before and after the booted method you can declare the next hooks methods in your filament page.\n\n```php\n\u003c?php\n\nnamespace App\\Filament\\Pages;\n\nuse ...;\nuse BezhanSalleh\\FilamentShield\\Traits\\HasPageShield;\n\nclass MyPage extends Page\n{\n    use HasPageShield;\n    ...\n\n    protected function beforeBooted() : void {\n        ...\n    }\n\n    protected function afterBooted() : void {\n        ...\n    }\n\n    /**\n     * Hook to perform an action before redirect if the user\n     * doesn't have access to the page.  \n     * */\n    protected function beforeShieldRedirects() : void {\n        ...\n    }\n}\n```\n\n###### Pages Redirect Path\n\n`HasPageShield` uses the `config('filament.path')` value by default to perform the shield redirection. If you need to overwrite the rediretion path, just add the next method to your page:\n\n```php\n\u003c?php\n\nnamespace App\\Filament\\Pages;\n\nuse ...;\nuse BezhanSalleh\\FilamentShield\\Traits\\HasPageShield;\n\nclass MyPage extends Page\n{\n    use HasPageShield;\n    ...\n\n    protected function getShieldRedirectPath(): string {\n        return '/'; // redirect to the root index...\n    }\n}\n```\n\n#### Widgets\n\nif you have generated permissions for `Widgets` you can toggle their state based on whether a user have permission or not. You can set this up manually but this package comes with a `HasWidgetShield` trait to speed up this process. All you have to do is use the trait in you widgets:\n```php\n\u003c?php\n\nnamespace App\\Filament\\Widgets;\n\nuse ...;\nuse BezhanSalleh\\FilamentShield\\Traits\\HasWidgetShield;\n\nclass IncomeWidget extends LineChartWidget\n{\n    use HasWidgetShield;\n    ...\n}\n```\n\n### Policies\n\n#### Path\nIf your policies are not in the default `Policies` directory in the `app_path()` you can change the directory name in the config file:\n\n```php\n...\n'generator' =\u003e [\n    'option' =\u003e 'policies_and_permissions',\n    'policy_directory' =\u003e 'Policies',\n],\n...\n```\n\n#### Policy Discovery \n\nGot a ton of policies inside subdirectories? Have to manually register them! right?\n\nWell, you can or you could instruct Laravel to automatically detect and register policies—even in subdirectories for you.\n\nJust add this to the `boot()` method:\n\n📌 Laravel 10 → `AuthServiceProvider`\n\n📌 Laravel 11+ → `xxServiceProvider`.\n\n```\npublic function boot(): void\n{\n    Gate::guessPolicyNamesUsing(function (string $modelClass) {\n        return str_replace('Models', 'Policies', $modelClass) . 'Policy';\n    });\n}\n```\n\n#### Third-Party Plugins Policies\n\nShield also generates policies and permissions for third-party plugins. To enforce the generated policies you will need to register them.\n##### Using Laravel 10\n```php\n//AuthServiceProvider.php\n...\nclass AuthServiceProvider extends ServiceProvider\n{\n    ...\n    protected $policies = [\n        ...,\n        'App\\Models\\Blog\\Author' =\u003e 'App\\Policies\\Blog\\AuthorPolicy',\n        'Ramnzys\\FilamentEmailLog\\Models\\Email' =\u003e 'App\\Policies\\EmailPolicy'\n\n    ];\n```\n\n##### Using Laravel 11\n```php\n//AppServiceProvider.php\nuse Illuminate\\Support\\Facades\\Gate;\n...\nclass AppServiceProvider extends ServiceProvider\n{\n    ...\n   public function boot(): void\n    {\n        ...\n        Gate::policy(\\App\\Models\\Blog\\Author::class, \\App\\Policies\\Blog\\AuthorPolicy::class);\n        Gate::policy(\\Ramnzys\\FilamentEmailLog\\Models\\Email::class, \\App\\Policies\\EmailPolicy::class);\n    }\n```\n\n#### Users (Assigning Roles to Users)\nShield does not come with a way to assign roles to your users out of the box, however you can easily assign roles to your users using Filament `Forms`'s `Select` or `CheckboxList` component. Inside your users `Resource`'s form add one of these components and configure them as you need:\n1. **Without Tenancy**\n```php\n// Using Select Component\nForms\\Components\\Select::make('roles')\n    -\u003erelationship('roles', 'name')\n    -\u003emultiple()\n    -\u003epreload()\n    -\u003esearchable(),\n                    \n// Using CheckboxList Component\nForms\\Components\\CheckboxList::make('roles')\n    -\u003erelationship('roles', 'name')\n    -\u003esearchable(),\n```\n2. **With Tenancy**\n```php\n// Using Select Component\nForms\\Components\\Select::make('roles')\n      -\u003erelationship('roles', 'name')\n      -\u003esaveRelationshipsUsing(function (Model $record, $state) {\n           $record-\u003eroles()-\u003esyncWithPivotValues($state, [config('permission.column_names.team_foreign_key') =\u003e getPermissionsTeamId()]);\n      })\n     -\u003emultiple()\n     -\u003epreload()\n     -\u003esearchable(),\n\n// Using CheckboxList Component\nForms\\Components\\CheckboxList::make('roles')\n      -\u003erelationship(name: 'roles', titleAttribute: 'name')\n      -\u003esaveRelationshipsUsing(function (Model $record, $state) {\n           $record-\u003eroles()-\u003esyncWithPivotValues($state, [config('permission.column_names.team_foreign_key') =\u003e getPermissionsTeamId()]);\n      })\n     -\u003esearchable(),\n```\nYou can find out more about these components in the [Filament Docs](https://filamentphp.com/docs/3.x/forms/installation)\n\n- [Select](https://filamentphp.com/docs/3.x/forms/fields/select)\n- [CheckboxList](https://filamentphp.com/docs/3.x/forms/fields/checkbox-list)\n\n#### Layout Customization\nYou can easily customize the `Grid`, `Section` and `CheckboxList`'s `columns()` and `columnSpan()` without publishing the resource.\n```php\nuse BezhanSalleh\\FilamentShield\\FilamentShieldPlugin;\n\npublic function panel(Panel $panel): Panel\n{\n        return $panel\n            ...\n            ...\n            -\u003eplugins([\n                FilamentShieldPlugin::make()\n                    -\u003egridColumns([\n                        'default' =\u003e 1,\n                        'sm' =\u003e 2,\n                        'lg' =\u003e 3\n                    ])\n                    -\u003esectionColumnSpan(1)\n                    -\u003echeckboxListColumns([\n                        'default' =\u003e 1,\n                        'sm' =\u003e 2,\n                        'lg' =\u003e 4,\n                    ])\n                    -\u003eresourceCheckboxListColumns([\n                        'default' =\u003e 1,\n                        'sm' =\u003e 2,\n                    ]),\n            ]);\n}\n```\n\u003cimg width=\"1161\" alt=\"Screenshot 2023-09-24 at 10 34 31 PM\" src=\"https://github.com/bezhanSalleh/filament-shield/assets/10007504/be42bab2-72d1-4db0-8de4-8b8fba2d4e68\"\u003e\n\n## Available Commands\n### Prohibited Commands\nSince almost all shield commands are destructive and can cause data loss, they can be prohibited by calling the prohibit method of the command as following in a service provider's `boot()` method:\n```php\nuse BezhanSalleh\\FilamentShield\\FilamentShield;\nuse BezhanSalleh\\FilamentShield\\Commands;\n    public function boot(): void\n    {\n        // individually prohibit commands\n        Commands\\SetupCommand::prohibit($this-\u003eapp-\u003eisProduction());\n        Commands\\InstallCommand::prohibit($this-\u003eapp-\u003eisProduction());\n        Commands\\GenerateCommand::prohibit($this-\u003eapp-\u003eisProduction());\n        Commands\\PublishCommand::prohibit($this-\u003eapp-\u003eisProduction());\n        // or prohibit the above commands all at once\n        FilamentShield::prohibitDestructiveCommands($this-\u003eapp-\u003eisProduction())\n    }\n```\n### Core Commands\n```bash\n# Setup Shield\nshield:setup [--fresh] [--minimal] [--tenant=]\n\n# Install Shield for a panel\nshield:install {panel} [--tenant] [--generate-relationships]\n\n# Generate permissions/policies\nshield:generate [options]\n\n# Create super admin\nshield:super-admin [--user=] [--panel=] [--tenant=]\n\n# Create seeder\nshield:seeder [options]\n\n# Publish Role Resource\nshield:publish {panel}\n```\n\n### Generate Command Options\n```bash\n--all                     Generate for all entities\n--option=[OPTION]         Override generator option\n--resource=[RESOURCE]     Specific resources\n--page=[PAGE]            Specific pages  \n--widget=[WIDGET]        Specific widgets\n--exclude                Exclude entities\n--ignore-config-exclude  Ignore config excludes\n--panel[=PANEL]          Panel ID to get the components(resources, pages, widgets)\n```\n\u003e [!NOTE] \n\u003e For setting up super-admin user when using tenancy/team feature consult the core package **[spatie/laravel-permission](https://spatie.be/docs/laravel-permission/v6/basic-usage/teams-permissions)**\n\n#### Translations \n\nPublish the translations using:\n\n```bash\nphp artisan vendor:publish --tag=\"filament-shield-translations\"\n```\n\n## Testing\n\n```bash\ncomposer test\n```\n\n## Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.\n\n## Contributing\n\nPlease see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.\n\n## Security Vulnerabilities\n\nPlease review [our security policy](../../security/policy) on how to report security vulnerabilities.\n\n## Credits\n\n- [Bezhan Salleh](https://github.com/bezhanSalleh)\n- [All Contributors](../../contributors)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FbezhanSalleh%2Ffilament-shield","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FbezhanSalleh%2Ffilament-shield","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FbezhanSalleh%2Ffilament-shield/lists"}