dutchcodingcompany/filament-developer-logins 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

dutchcodingcompany/filament-developer-logins

Composer 安装命令:

composer require dutchcodingcompany/filament-developer-logins

包简介

Add buttons to the login page of Filament to login as a specific user.

README 文档

README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

This plugin allows you to enable one-click logins for your local Filament panels, which is useful when developing a Filament project with multiple users and various roles.

example-screenshot.png

Installation

Filament version Package version Readme
^5.x ^2.1.x Link
^4.x 2.x.x Link
^3.x 1.x.x Link

You can install the package via composer.

composer require dutchcodingcompany/filament-developer-logins

Usage

Register the plugin in the Filament panel provider (the default file is app/Providers/Filament/AdminPanelProvider.php).

In the users method you can define the users (note: the users must exist), the key is used as a label on the login button and the value is used to search the user in the database.

// ...
->plugins([
    FilamentDeveloperLoginsPlugin::make()
        ->enabled(app()->environment('local'))
        ->users([
            'Admin' => 'admin@example.com',
            'User' => 'user@example.com',
        ])
]);

The users() method can also be passed a closure to compute the users list at render time, for example from the database.

// ...
FilamentDeveloperLoginsPlugin::make()
    ->users(fn () => User::pluck('email', 'name')->toArray())
]);

Customization

enabled()

By default, the plugin is disabled. You can enable it by calling the enabled() method. I strongly suggest enabling this plugin only in the local environment. You can achieve this by using the app()->environment() method. Additionally, the enabled() method also accepts a closure if you wish to enable the plugin based on a custom condition.

Example:

// ...
FilamentDeveloperLoginsPlugin::make()
    ->enabled(fn() => app()->environment('local'))

switchable()

By default, a "Switch to" button is shown in the top right corner of the screen, so you can easily switch between the provided users. If you want to disable this feature, you can use the switchable() method.

// ...
FilamentDeveloperLoginsPlugin::make()
    ->switchable(false) // This also accepts a closure.

switchable-screenshot.png

column()

By default, the user column is set to email. If you want to use a different column, you can use the column() method.

Example:

FilamentDeveloperLoginsPlugin::make()
    ->column('name')

modelClass()

By default, the model class is set to App\Models\User. If you want to use a different model, you can use the modelClass() method.

Example:

FilamentDeveloperLoginsPlugin::make()
    ->modelClass(Admin::class)

redirectTo()

By default, the user will be redirected using the Filament::getUrl() method, which directs them to the dashboard. In the case of multi-tenancy, the user will also be redirected to the correct tenant. If you prefer to use a different url, you can utilize the redirectTo() method.

FilamentDeveloperLoginsPlugin::make()
    ->redirectTo('/custom-url')

Since the routes are not yet registered when the plugin is created, you need to use a closure to redirect to a named route.

FilamentDeveloperLoginsPlugin::make()
    ->redirectTo(fn () => route('custom.route'))

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

dutchcodingcompany/filament-developer-logins 适用场景与选型建议

dutchcodingcompany/filament-developer-logins 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 231.43k 次下载、GitHub Stars 达 61, 最近一次更新时间为 2024 年 04 月 26 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「laravel」 「filament」 「dutchcodingcompany」 「filament-developer-logins」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 dutchcodingcompany/filament-developer-logins 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 dutchcodingcompany/filament-developer-logins 我们能提供哪些服务?
定制开发 / 二次开发

基于 dutchcodingcompany/filament-developer-logins 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 231.43k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 62
  • 点击次数: 23
  • 依赖项目数: 37
  • 推荐数: 0

GitHub 信息

  • Stars: 61
  • Watchers: 2
  • Forks: 20
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-04-26