PHPackages                             gerenuk/filament-banhammer - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. gerenuk/filament-banhammer

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

gerenuk/filament-banhammer
==========================

This package adds model banning functionality to filament

v1.2.0(9mo ago)122.5k↑100%3[4 PRs](https://github.com/Gerenuk-LTD/filament-banhammer/pulls)MITPHPPHP ^8.2CI passing

Since May 29Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/Gerenuk-LTD/filament-banhammer)[ Packagist](https://packagist.org/packages/gerenuk/filament-banhammer)[ Docs](https://github.com/gerenuk-ltd/filament-banhammer)[ GitHub Sponsors](https://github.com/Gerenuk)[ RSS](/packages/gerenuk-filament-banhammer/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (6)Dependencies (14)Versions (14)Used By (0)

[![Project banner](https://camo.githubusercontent.com/1a9a615e6d25c5d794b5b076ce1e7fd6d6f44b4f186deb18dee435d3af327b83/68747470733a2f2f62616e6e6572732e6265796f6e64636f2e64652f46696c616d656e7425323042616e68616d6d65722e706e673f7468656d653d6c69676874267061636b6167654d616e616765723d636f6d706f7365722b72657175697265267061636b6167654e616d653d676572656e756b25324666696c616d656e742d62616e68616d6d6572267061747465726e3d627269636b57616c6c267374796c653d7374796c655f31266465736372697074696f6e3d42616e2b7265736f75726365732b696e2b796f75722b46696c616d656e742b70726f6a656374266d643d312673686f7757617465726d61726b3d3026666f6e7453697a653d313030707826696d616765733d62616e)](https://camo.githubusercontent.com/1a9a615e6d25c5d794b5b076ce1e7fd6d6f44b4f186deb18dee435d3af327b83/68747470733a2f2f62616e6e6572732e6265796f6e64636f2e64652f46696c616d656e7425323042616e68616d6d65722e706e673f7468656d653d6c69676874267061636b6167654d616e616765723d636f6d706f7365722b72657175697265267061636b6167654e616d653d676572656e756b25324666696c616d656e742d62616e68616d6d6572267061747465726e3d627269636b57616c6c267374796c653d7374796c655f31266465736372697074696f6e3d42616e2b7265736f75726365732b696e2b796f75722b46696c616d656e742b70726f6a656374266d643d312673686f7757617465726d61726b3d3026666f6e7453697a653d313030707826696d616765733d62616e)

Filament Banhammer
==================

[](#filament-banhammer)

[![Latest Version on Packagist](https://camo.githubusercontent.com/890470693b0ffe98b8d84f3b8c3897b1d06e187cfb3fd666a6e31e3d97b79a8e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f676572656e756b2f66696c616d656e742d62616e68616d6d65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/gerenuk/filament-banhammer)[![GitHub Tests Action Status](https://camo.githubusercontent.com/35d527a99073fb739981ccf28463632b9c5a3eef13a0d8ecbd0229a949b440bf/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f676572656e756b2d6c74642f66696c616d656e742d62616e68616d6d65722f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/gerenuk-ltd/filament-banhammer/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/fb1aa1151ac23c7a8029412d74acb0b8b2fe66f2a1c27f8b2203e9b0cd538c6e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f676572656e756b2d6c74642f66696c616d656e742d62616e68616d6d65722f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/gerenuk-ltd/filament-banhammer/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/463d233b521b527eeb676f44a6c50e57186a4e9a0b65daf8ada41495d6a41345/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f676572656e756b2f66696c616d656e742d62616e68616d6d65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/gerenuk/filament-banhammer)[![Licence](https://camo.githubusercontent.com/a63ac2286979b1f48bd3a640313822136811fde06501966dfde7d750c74e4292/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f476572656e756b2d4c54442f66696c616d656e742d62616e68616d6d65723f636f6c6f723d626c7565266c6162656c3d6c6963656e7365267374796c653d666c61742d737175617265)](https://github.com/Gerenuk-LTD/filament-banhammer/blob/main/LICENSE.md)

This package uses [mchev/banhammer](https://github.com/mchev/banhammer) to add model banning functionality to filament.

Table of Contents
-----------------

[](#table-of-contents)

1. [Introduction](#filament-banhammer)
2. [Version Compatibility](#version-compatibility)
3. [Installation](#installation)
4. [Usage](#usage)
    - [Registering the Plugin](#usage)
    - [Ban](#ban)
    - [Unban](#unban)
    - [Ban Bulk](#ban-bulk)
    - [Unban Bulk](#unban-bulk)
5. [Testing](#testing)
6. [Screenshots](#screenshots)
    - [Resource](#resource)
    - [Ban Action](#ban-action)
    - [Ban Bulk Action](#ban-bulk-action)
    - [Ban Modal](#ban-modal)
    - [Unban Action](#unban)
    - [Unban Bulk Action](#unban-bulk)
    - [Unban Modal](#unban-modal)
7. [Changelog](#changelog)
8. [Contributing](#contributing)
9. [Security Vulnerabilities](#security-vulnerabilities)
10. [Credits](#credits)
11. [License](#license)

Version Compatibility
---------------------

[](#version-compatibility)

PluginFilamentLaravelPHP1.x3.x10.x8.x1.x3.x11.x8.2|8.3Installation
------------

[](#installation)

This package depends on [mchev/banhammer](https://github.com/mchev/banhammer) please follow the install guide there first.

You can install the package via composer:

```
composer require gerenuk/filament-banhammer
```

Important

Ensure you have already installed [mchev/banhammer](https://github.com/mchev/banhammer) before doing this.

You can publish the config file with:

```
php artisan vendor:publish --tag="filament-banhammer-config"
```

This is the contents of the published config file:

 Click to expand!```
return [

    /*
     * The name of the resource which the plugin should use.
     */
    'resource' => \Gerenuk\FilamentBanhammer\Resources\BanhammerResource::class,

    /*
     * Whether an export action should be included on the resource.
     */
    'show_export' => true,

    /*
     * Options for the actions.
     */
    'actions' => [

        /*
         * Options for the ban action.
         */
        'ban' => [

            /*
             * The title of the ban action.
             */
            'label' => 'ban',

            /*
             * The colour of the ban action.
             */
            'colour' => 'warning',

            /*
             * The symbol of the ban action.
             */
            'icon' => 'heroicon-o-no-symbol',

            /*
             * Whether confirming is required when using the ban action.
             */
            'require_confirmation' => true,

            /*
             * Notification options for the ban action.
             */
            'notifications' => [

                /*
                 * Whether a notification should be shown for the ban action.
                 */
                'show' => true,

                /*
                 * Success options for the ban action notifications.
                 */
                'success' => [

                    /*
                    * The title of the success notification for the ban action.
                    */
                    'title' => 'Banned',

                ],

                /*
                 * Error options for the ban action notifications.
                 */
                'error' => [

                    /*
                    * The title of the error notification for the ban action.
                    */
                    'title' => 'Failed',

                ],

            ],

        ],

        /*
         * Options for the edit ban action.
         */
        'edit_ban' => [

            /*
             * The title of the edit ban action.
             */
            'label' => 'edit ban',

            /*
             * The colour of the edit ban action.
             */
            'colour' => 'warning',

            /*
             * The symbol of the edit ban action.
             */
            'icon' => 'heroicon-o-pencil-square',

            /*
             * Whether confirming is required when using the edit ban action.
             */
            'require_confirmation' => true,

            /*
             * Notification options for the edit ban action.
             */
            'notifications' => [

                /*
                 * Whether a notification should be shown for the edit ban action.
                 */
                'show' => true,

                /*
                 * Success options for the edit ban action notifications.
                 */
                'success' => [

                    /*
                    * The title of the success notification for the edit ban action.
                    */
                    'title' => 'Saved',

                ],

                /*
                 * Error options for the edit ban action notifications.
                 */
                'error' => [

                    /*
                    * The title of the error notification for the edit ban action.
                    */
                    'title' => 'Failed',

                ],

            ],

        ],

        /*
         * Options for the unban action.
         */
        'unban' => [

            /*
             * The title of the unban action.
             */
            'label' => 'unban',

            /*
             * The colour of the unban action.
             */
            'colour' => 'warning',

            /*
             * The symbol of the unban action.
             */
            'icon' => 'heroicon-o-no-symbol',

            /*
             * Whether confirming is required when using the unban action.
             */
            'require_confirmation' => true,

            /*
             * Notification options for the unban action.
             */
            'notifications' => [

                /*
                 * Whether a notification should be shown for the unban action.
                 */
                'show' => true,

                /*
                 * Success options for the unban action notifications.
                 */
                'success' => [

                    /*
                    * The title of the success notification for the unban action.
                    */
                    'title' => 'Unbanned',

                ],

                /*
                 * Error options for the unban action notifications.
                 */
                'error' => [

                    /*
                    * The title of the error notification for the unban action.
                    */
                    'title' => 'Failed',

                ],

            ],

        ],

        /*
         * Options for the ban bulk action.
         */
        'ban_bulk' => [

            /*
             * The title of the ban bulk action.
             */
            'label' => 'ban',

            /*
             * The colour of the ban bulk action.
             */
            'colour' => 'warning',

            /*
             * The symbol of the ban bulk action.
             */
            'icon' => 'heroicon-o-no-symbol',

            /*
             * Whether confirming is required when using the ban bulk action.
             */
            'require_confirmation' => true,

            /*
             * Notification options for the ban bulk action.
             */
            'notifications' => [

                /*
                 * Whether a notification should be shown for the ban bulk action.
                 */
                'show' => true,

                /*
                 * Success options for the ban bulk action notifications.
                 */
                'success' => [

                    /*
                    * The title of the success notification for the ban bulk action.
                    */
                    'title' => 'Banned',

                ],

                /*
                 * Error options for the ban bulk action notifications.
                 */
                'error' => [

                    /*
                    * The title of the error notification for the ban bulk action.
                    */
                    'title' => 'Failures',

                ],

            ],

        ],

        /*
         * Options for the edit ban bulk action.
         */
        'edit_ban_bulk' => [

            /*
             * The title of the edit ban bulk action.
             */
            'label' => 'edit ban',

            /*
             * The colour of the edit ban bulk action.
             */
            'colour' => 'warning',

            /*
             * The symbol of the edit ban bulk action.
             */
            'icon' => 'heroicon-o-pencil-square',

            /*
             * Whether confirming is required when using the edit ban bulk action.
             */
            'require_confirmation' => true,

            /*
             * Notification options for the edit ban bulk action.
             */
            'notifications' => [

                /*
                 * Whether a notification should be shown for the edit ban bulk action.
                 */
                'show' => true,

                /*
                 * Success options for the edit ban bulk action notifications.
                 */
                'success' => [

                    /*
                    * The title of the success notification for the edit ban bulk action.
                    */
                    'title' => 'Saved',

                ],

                /*
                 * Error options for the edit ban bulk action notifications.
                 */
                'error' => [

                    /*
                    * The title of the error notification for the edit ban bulk action.
                    */
                    'title' => 'Failures',

                ],

            ],

        ],

        /*
         * Options for the unban bulk action.
         */
        'unban_bulk' => [

            /*
             * The title of the unban bulk action.
             */
            'label' => 'unban',

            /*
             * The colour of the unban bulk action.
             */
            'colour' => 'warning',

            /*
             * The symbol of the unban bulk action.
             */
            'icon' => 'heroicon-o-no-symbol',

            /*
             * Whether confirming is required when using the unban bulk action.
             */
            'require_confirmation' => true,

            /*
             * Notification options for the unban bulk action.
             */
            'notifications' => [

                /*
                 * Whether a notification should be shown for the unban bulk action.
                 */
                'show' => true,

                /*
                 * Success options for the unban bulk action notifications.
                 */
                'success' => [

                    /*
                    * The title of the success notification for the unban bulk action.
                    */
                    'title' => 'Unbanned',

                ],

                /*
                 * Error options for the unban bulk action notifications.
                 */
                'error' => [

                    /*
                    * The title of the error notification for the unban bulk action.
                    */
                    'title' => 'Failures',

                ],

            ],

        ],

    ],

];

```

Usage
-----

[](#usage)

You first need to register the plugin with Filament. This can be done inside of your `PanelProvider`, e.g. `AdminPanelProvider`.

```
