定制 tapp/filament-authentication-log 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

tapp/filament-authentication-log

Composer 安装命令:

composer require tapp/filament-authentication-log

包简介

Filament authentication log plugin.

README 文档

README

Latest Version on Packagist Code Style Action Status - Pint Total Downloads

A Filament plugin for Laravel Authentication Log package.

This package provides a Filament resource and a relation manager for Laravel Authentication Log.

Dependencies

Follow the configuration instructions for laravel-authentication-log

  • Publish and run the migrations
  • Add the AuthenticationLoggable and Notifiable traits to your User model

Version Compatibility

Filament Laravel Laravel Authentication Log Filament Authentication Log Documentation
2.x 9.x/10.x 3.x 2.x Check the docs
3.x 10.x/11.x 4.x 3.x Check the docs
3.x 12.x 5.x 4.x Check the docs
4.x/5.x 12.x 5.x/6.x 5.x Current

Installation

Important

Please check the Filament Authentication Log plugin version you should use in the Version Compatibility table above.

You can install the plugin via Composer:

composer require tapp/filament-authentication-log:"^5.0"

You can publish the translations files with:

php artisan vendor:publish --tag="filament-authentication-log-translations"

You can publish the config file with:

php artisan vendor:publish --tag="filament-authentication-log-config"

Using the Resource

Add this plugin to a panel in the plugins() method. E.g., in app/Providers/Filament/AdminPanelProvider.php:

use Tapp\FilamentAuthenticationLog\FilamentAuthenticationLogPlugin;
 
public function panel(Panel $panel): Panel
{
    return $panel
        // ...
        ->plugins([
            FilamentAuthenticationLogPlugin::make()
                // ->panelName('admin') // Optional: specify the panel name if needed
        ]);
}

That's it! Now you can see the Authentication Log resource on left sidebar.

This customization ->panelName('admin') allows for better organization if you have multiple panels, such as Developer and Admin panels, where the FilamentAuthenticationLogPlugin is used in one panel but the user resource is available only in another panel.

Resource appearance

Filament Authentication Log Resource

Filament Authentication Log Resource with filters and tooltip

Using the Relation Manager

Add the Tapp\FilamentAuthenticationLog\RelationManagers\ to the getRelations() method on the Filament resource where the model uses the AuthenticationLoggable trait.

E.g. in App\Filament\Resources\UserResource.php:

use Tapp\FilamentAuthenticationLog\RelationManagers\AuthenticationLogsRelationManager;
 
public static function getRelations(): array
{
    return [
        AuthenticationLogsRelationManager::class,
        // ...
    ];
}

Relation manager appearance

Filament Authentication Log Relation Manager

Displaying Authenticatable Names

To display the actual name of the authenticatable user instead of the class name, you can configure the plugin to show a specific field. By default, it will use the name field if available. If your model does not have a name column, you can add a custom attribute:

In your model:

public function getNameAttribute(): string
{
    return trim($this->first_name . ' ' . $this->last_name);
}

Configuration

To specify a custom field to display for the authenticatable user, update the config/filament-authentication-log.php configuration file:

'authenticatable' => [
    'field-to-display' => 'name', // Change 'name' to your custom field if needed
    'resource-page' => 'edit', // Change 'edit' to another resource page, such as 'view'
],

Authenticatable Resource Page

By default, the authenticatable link points to the edit page of the detected Filament resource. To link to another resource page, such as view, update the resource-page configuration value:

'authenticatable' => [
    'resource-page' => 'view',
],

Make sure the target resource defines the configured page name.

Custom User Resource

If you have a custom user resource in your application that is not automatically detected by the package, you can specify it in your configuration file. This is particularly useful when:

  • Your user resource has a non-standard name or location
  • You have multiple panels and the default user resource detection fails
  • You want to link authentication logs to a specific user resource implementation

To configure a custom user resource, add this to your config/filament-authentication-log.php file:

'user-resource' => \App\Filament\Resources\YourCustomUserResource::class,

This configuration allows the authentication log to properly generate edit links to your user records on resource, even when the default user resource detection mechanism cannot find them.

License

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

tapp/filament-authentication-log 适用场景与选型建议

tapp/filament-authentication-log 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 179.28k 次下载、GitHub Stars 达 51, 最近一次更新时间为 2023 年 08 月 16 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

围绕 tapp/filament-authentication-log 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

  • Stars: 51
  • Watchers: 4
  • Forks: 28
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-08-16