PHPackages                             cybercog/laravel-nova-ban - 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. [Database &amp; ORM](/categories/database)
4. /
5. cybercog/laravel-nova-ban

ActiveLibrary[Database &amp; ORM](/categories/database)

cybercog/laravel-nova-ban
=========================

A Laravel Nova banning functionality for your application.

2.0.0(3y ago)40199.8k↓30.9%5[3 issues](https://github.com/cybercog/laravel-nova-ban/issues)MITPHPPHP ^7.1.3|^8.0

Since Aug 23Pushed 3y ago2 watchersCompare

[ Source](https://github.com/cybercog/laravel-nova-ban)[ Packagist](https://packagist.org/packages/cybercog/laravel-nova-ban)[ Docs](https://komarev.com/sources/laravel-nova-ban)[ Fund](https://paypal.me/antonkomarev)[ RSS](/packages/cybercog-laravel-nova-ban/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)Dependencies (2)Versions (6)Used By (0)

Laravel Nova Ban
================

[](#laravel-nova-ban)

[![cog-laravel-nova-ban](https://user-images.githubusercontent.com/1849174/44558292-ffc0a080-a74b-11e8-8699-a79de865910d.png)](https://user-images.githubusercontent.com/1849174/44558292-ffc0a080-a74b-11e8-8699-a79de865910d.png)

[![Releases](https://camo.githubusercontent.com/a29d0b50f16250a9321c935b34556c987084e0918bf838f3a3a3c88f1d3e4aae/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f6379626572636f672f6c61726176656c2d6e6f76612d62616e2e7376673f7374796c653d666c61742d737175617265)](https://github.com/cybercog/laravel-nova-ban/releases)[![StyleCI](https://camo.githubusercontent.com/9842dc5ccef77e0715f7f793108233b7d74b6bbe1cd617f66d15760607fad87c/68747470733a2f2f7374796c6563692e696f2f7265706f732f3134353837343233332f736869656c64)](https://styleci.io/repos/145874233)[![License](https://camo.githubusercontent.com/94f743163ae5e2eda6cb37a488cf2a91021c26cf2a25962f0db2b34fc94731eb/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6379626572636f672f6c61726176656c2d6e6f76612d62616e2e7376673f7374796c653d666c61742d737175617265)](https://github.com/cybercog/laravel-nova-ban/blob/master/LICENSE)

Introduction
------------

[](#introduction)

Behind the scenes [cybercog/laravel-ban](https://github.com/cybercog/laravel-ban) is used.

[![laravel-nova-ban-preview](https://user-images.githubusercontent.com/1849174/44547881-1b648080-a725-11e8-9472-bad1486c06f0.png)](https://user-images.githubusercontent.com/1849174/44547881-1b648080-a725-11e8-9472-bad1486c06f0.png)

Contents
--------

[](#contents)

- [Installation](#installation)
- [Usage](#usage)
    - [Prepare bannable model](#prepare-bannable-model)
    - [Prepare bannable model database table](#prepare-bannable-model-database-table)
    - [Register Ban Actions in Nova Resource](#register-ban-actions-in-nova-resource)
- [Contributing](#contributing)
- [Testing](#testing)
- [Security](#security)
- [Contributors](#contributors)
- [Alternatives](#alternatives)
- [License](#license)
- [About CyberCog](#about-cybercog)

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

[](#installation)

Pull in the package through Composer.

```
composer require cybercog/laravel-nova-ban
```

Usage
-----

[](#usage)

### Prepare bannable model

[](#prepare-bannable-model)

```
use Cog\Contracts\Ban\Bannable as BannableContract;
use Cog\Laravel\Ban\Traits\Bannable;
use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable implements BannableContract
{
    use Bannable;
}
```

### Prepare bannable model database table

[](#prepare-bannable-model-database-table)

Bannable model must have `nullable timestamp` column named `banned_at`. This value used as flag and simplify checks if user was banned. If you are trying to make default Laravel User model to be bannable you can use example below.

#### Create a new migration file

[](#create-a-new-migration-file)

```
php artisan make:migration add_banned_at_column_to_users_table
```

Then insert the following code into migration file:

```
