marksihor/laravel-blacklists

Laravel blacklists

1.00 2020-05-27 08:31 UTC

This package is auto-updated.

Last update: 2024-10-27 18:42:21 UTC


README

The package allows you to make blacklists with specified types and values.

Installing

$ composer require marksihor/laravel-blacklists -vvv

Usage

Use trait in Model you wish to use blacklist on

<?php

namespace App;

use MarksIhor\LaravelBlacklists\Blacklistable;

class User extends Authenticatable implements MustVerifyEmail
{
    use Blacklistable;
    <...>
}

Usage examples

$user->addToBlacklist('user', 7); // add to blacklist
$user->removeFromBlacklist('user', 5); // remove from blacklist
$user->checkIfInBlacklist('user', 5); // check if in blacklist
$user->getBlacklists(); // view all blacklists

The package uses Cache facade to cache all queries.

License

MIT