rakshitbharat/supersu

rakshitbharat/supersu是一个实用程序包,允许开发者在开发过程中以其他用户身份登录。

v1.0 2017-11-05 13:49 UTC

This package is auto-updated.

Last update: 2024-09-13 20:47:10 UTC


README

这是一个Laravel 5.5实用程序包,允许开发者在开发过程中以其他用户身份登录。

安装

要安装此包,请按照以下步骤操作。

使用Composer安装包

$ composer require rakshitbharat/supersu

⚠️ 警告:您不应该像通常在config/app.php文件中那样全局注册提供者。有关更多信息,请参阅此处的免责声明。

在布局文件中包含部分

@if (config('app.debug'))
    @include('supersu::user-selector')
@endif

最后,发布包的资产(没有这些包将无法工作)

$ php artisan vendor:publish

配置

运行vendor:publish后,应在您的项目中出现一个名为supersu.php的配置文件。在此处,有两个配置值。

sudosu.user_model 字符串

The path to the application User model. This will be used to retrieve the users displayed in the select dropdown. This must be an Eloquent Model instance. This is set to `App\User` by default.

事件

以下是用户切换前后调用的事件。您可以将以下文件复制以扩展您的逻辑。

<?php

namespace App\Facades;

class SupersuCustom {

    public static function loginAsUser($object = null) {

    }

    public static function returnCurrent($object = null) {

    }

}

免责声明 - 警报!

如果使用不当,此包可能会引发严重的安全问题,因为任何人都可以接管任何用户的账户。请确保只有在应用处于调试/本地环境时才注册服务提供者。

通过使用此包,您同意Rakshit Patel和此包的贡献者对使用此包造成的任何损害不承担责任。