meerkatmcr / simple-blocker
Simple user-blocking functionality for Laravel 5.x
Installs: 7
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/meerkatmcr/simple-blocker
Requires
- illuminate/support: ^5.0
This package is auto-updated.
Last update: 2025-10-13 01:08:33 UTC
README
Very simple user-blocking functionality for Laravel 5.x
Installation
Notes
This package assumes that your users table is called users. If it is not,
publish the migration and edit the table name.
Method
- Install the package with
composer install meerkatmcr/simple-blocker - Perform the database migration
php artisan migrate - Add the
MeerkatMcr\SimpleBlocker\Traits\Blockabletrait to your user model.
Usage
Blocking and unblocking
The Blockable trait provides three methods:
block()block the userunblock()unblock the userisBlocked()returnTRUEif the user is blocked
block() and unblock() are both fluent, and neither saves the model.
Middleware
The MeerkatMcr\SimpleBlocker\Middleware\CheckUserBlocked middleware will abort
a request with code 403 if the current user is blocked.
To use it, register it in app/Http/Kernel.php as with any other middleware
class. See the
Laravel manual
for further details.
The abort message is configurable - its key is simple-blocker.message. This
package publishes its config file (simple-blocker.php).