承接 26b/laravel-account-status 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

26b/laravel-account-status

最新稳定版本:v1.0.1

Composer 安装命令:

composer require 26b/laravel-account-status

包简介

Laravel package for account statuses

README 文档

README

Configurable statuses for your user accounts.

  • Handle access to application conditionally.
  • Artisan command to toggle status for given user.
  • Artisan command to activate X accounts.

Getting started

Require the package

composer require 26b/laravel-account-status

To setup your database using the builtin migration.

php artisan vendor:publish --tag=account-status-migrations
php artisan migrate

Now that you have migrated, you might want to set your existing users to the ACTIVE state. You can do this X at a time.

php artisan account-status:activate 100

Usage

To protect your routes and redirect to the account status page you can add the builtin middleware to your kernel or individually to your routes.

    \TwentySixB\LaravelAccountStatus\Http\Middleware\EnsureAccountActive::class,

Commands

Toggle You can change the status for a given user ID like this.

php artisan account-status:toggle ID SUSPENDED

Activate When you have, for example, QUEUED users you can change their status to ACTIVE by running the command

php artisan account-status:activate 50

Factories

You can add some states to your factories to test your app.

$user = User::factory()->queued()->make();
use TwentySixB\LaravelAccountStatus\AccountStatus;

...

/**
 * Indicate that the model's is in a queued state.
 *
 * @return \Illuminate\Database\Eloquent\Factories\Factory
 */
public function queued()
{
    return $this->state(
        function (array $attributes) {
            return [
                'status' => AccountStatus::QUEUED,
            ];
        }
    );
}

Customizing

Publish the configuration file should you need to customise it.

php artisan vendor:publish --tag=account-status-config

To customize the "account blocked template" you can publish the views and change them at your will.

php artisan vendor:publish --tag=account-status-views

统计信息

  • 总下载量: 2.26k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-04-20