lopatin96/laravel-user-statuses

Laravel user statuses

1.0.6 2023-10-04 13:47 UTC

This package is auto-updated.

Last update: 2024-12-04 16:16:18 UTC


README

Trait and Casts

Add HasUserStatus trait and casts to User model.

use Atin\LaravelSocialAuth\Traits\HasUserStatus;

class User extends Authenticatable
{
    use HasUserStatus;

    protected $casts = [
        'status' => \Atin\LaravelUserStatuses\Enums\UserStatus::class,
    ];

Add EnsureUserIsNotBlocked middleware to middleware array in app/Http/Kernel.php:

  protected $middlewareGroups = [
        'web' => [
            …
            \Atin\LaravelUserStatuses\Http\Middleware\EnsureUserIsNotBlocked::class,
        ],
    ];

Run migrations:

php artisan migrate

Publishing

Migrations

php artisan vendor:publish --tag="laravel-user-statuses-migrations"

Localization

php artisan vendor:publish --tag="laravel-user-statuses-lang"