web-id / ail
认证页面,在调试模式下轻松更改用户
1.0.2
2022-11-29 09:01 UTC
Requires
- php: ^8.1
- illuminate/contracts: ^9.0
- lab404/laravel-impersonate: ^1.7
- spatie/laravel-package-tools: ^1.13.0
Requires (Dev)
- laravel/pint: ^1.0
- nunomaduro/collision: ^6.0
- nunomaduro/larastan: ^2.0.1
- orchestra/testbench: ^7.0
- pestphp/pest: ^1.21
- pestphp/pest-plugin-laravel: ^1.1
- phpstan/extension-installer: ^1.1
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-phpunit: ^1.0
- phpunit/phpunit: ^9.5
This package is auto-updated.
Last update: 2024-09-20 06:44:48 UTC
README
认证页面,轻松更改用户
安装
1/ Composer
您可以通过 composer 安装此包
composer require web-id/ail
2/ 包安装
使用以下命令安装包(配置文件和视图)
php artisan ail:install
3/ 配置
更新配置,特别是 guard 和 allowedEnv。
这是已发布配置文件的内容
return [ /* |-------------------------------------------------------------------------- | Route configuration |-------------------------------------------------------------------------- | | These values will change the route configuration for the application routes. | You can define the prefix, the name and set your own middleware on it. | Web middleware is required for authentication and CanImpersonate for security. | */ 'routes' => [ 'prefix' => 'ail', 'name' => 'ail', 'middlewares' => [ 'web', CanImpersonate::class, ], ], /* |-------------------------------------------------------------------------- | Guards to display |-------------------------------------------------------------------------- | | This value is a list of guards that you want to display and impersonate. You | need to set the name on key and the service builder on value. The service | builder is required for search bar on view. By default, you can use | SearchUser::class that search on `name` attribute. You are free and encouraged | to create your own service. | */ 'guards' => [ 'web' => SearchUser::class, ], /* |-------------------------------------------------------------------------- | Allowed environment security |-------------------------------------------------------------------------- | | This value is a list of environments authorized for this package. It will | use APP_ENV. WARNING : This package is not recommended on risky environments | like production or preprod with sensitive data. */ 'allowedEnv' => [ 'local', 'preproduction', ], /* |-------------------------------------------------------------------------- | Pagination |-------------------------------------------------------------------------- | | This value is the pagination number for view. | */ 'perPage' => 15, ];
4/ 更新模型
在您想要冒充的 Authenticatable 模型上添加 Impersonate 特性。
class User extends Authenticatable { use Impersonate; }
5/ 更新视图
您可以在 resources/views/vendors/ail 中添加自己的逻辑。
默认情况下,它将显示 name 属性。
6/ 更多选项
见: https://github.com/404labfr/laravel-impersonate
警告:不要忘记设置授权,以确定谁可以冒充: https://github.com/404labfr/laravel-impersonate#defining-impersonation-authorization
默认情况下,所有用户都可以被冒充。
更新日志
有关最近更改的更多信息,请参阅 CHANGELOG
鸣谢
许可
MIT 许可证 (MIT)。有关更多信息,请参阅 许可文件
