feat(admin): add audit relation manager (#1159)

This commit is contained in:
Kyrch
2026-04-09 21:32:15 -03:00
committed by GitHub
parent 00560e9ab4
commit 07933577c1
5 changed files with 156 additions and 2 deletions
+2
View File
@@ -32,6 +32,7 @@ use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletingScope;
use Illuminate\Support\Facades\Gate;
use Tapp\FilamentAuditing\RelationManagers\AuditsRelationManager;
abstract class BaseResource extends Resource
{
@@ -169,6 +170,7 @@ abstract class BaseResource extends Resource
{
return [
ActionLogRelationManager::class,
AuditsRelationManager::class,
];
}
+4 -1
View File
@@ -44,6 +44,8 @@ use Kyrch\Prohibition\Traits\HasSanctions;
use Laravel\Fortify\TwoFactorAuthenticatable;
use Laravel\Sanctum\HasApiTokens;
use Laravel\Sanctum\PersonalAccessToken;
use OwenIt\Auditing\Auditable as HasAudits;
use OwenIt\Auditing\Contracts\Auditable;
use Spatie\Permission\Traits\HasRoles;
/**
@@ -75,9 +77,10 @@ use Spatie\Permission\Traits\HasRoles;
User::ATTRIBUTE_TWO_FACTOR_SECRET,
])]
#[Table(User::TABLE)]
class User extends Authenticatable implements FilamentUser, HasAvatar, HasSubtitle, MustVerifyEmail, Nameable, SoftDeletable
class User extends Authenticatable implements Auditable, FilamentUser, HasAvatar, HasSubtitle, MustVerifyEmail, Nameable, SoftDeletable
{
use HasApiTokens;
use HasAudits;
use HasFactory;
use HasRoles;
use HasSanctions;
+1
View File
@@ -60,6 +60,7 @@
"staudenmeir/laravel-adjacency-list": "^1.26.0",
"symfony/http-client": "^6.4.36",
"symfony/mailgun-mailer": "^6.4.24",
"tapp/filament-auditing": "^4.0.9",
"typesense/typesense-php": "^6.0",
"vinkla/hashids": "^14.0"
},
Generated
+78 -1
View File
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "6a4b422edafaaa03921e99f49f3f7ca0",
"content-hash": "0285ca031bb92442d1f8253fed71b53a",
"packages": [
{
"name": "ajcastro/eager-load-pivot-relations",
@@ -12150,6 +12150,83 @@
],
"time": "2026-03-31T07:15:36+00:00"
},
{
"name": "tapp/filament-auditing",
"version": "v4.0.9",
"source": {
"type": "git",
"url": "https://github.com/TappNetwork/filament-auditing.git",
"reference": "e36bc4fda98176dea9d8ef76b537f117d12f474a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/TappNetwork/filament-auditing/zipball/e36bc4fda98176dea9d8ef76b537f117d12f474a",
"reference": "e36bc4fda98176dea9d8ef76b537f117d12f474a",
"shasum": ""
},
"require": {
"filament/filament": "^5.0|^4.0",
"owen-it/laravel-auditing": "^14.0||^13.0",
"php": "^8.2",
"spatie/laravel-package-tools": "^1.16"
},
"require-dev": {
"larastan/larastan": "^2.9||^3.0",
"laravel/pint": "^1.14",
"nunomaduro/collision": "^8.1.1||^7.10.0",
"orchestra/testbench": "^10.0.0||^9.0.0",
"pestphp/pest": "^3.0||^2.34",
"pestphp/pest-plugin-arch": "^3.0||^2.7",
"pestphp/pest-plugin-laravel": "^3.0||^2.3",
"phpstan/extension-installer": "^1.3||^2.0",
"phpstan/phpstan-deprecation-rules": "^1.1||^2.0",
"phpstan/phpstan-phpunit": "^1.3||^2.0",
"spatie/laravel-ray": "^1.35"
},
"type": "library",
"extra": {
"laravel": {
"providers": [
"Tapp\\FilamentAuditing\\FilamentAuditingServiceProvider"
]
}
},
"autoload": {
"psr-4": {
"Tapp\\FilamentAuditing\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Tapp Network",
"email": "steve@tappnetwork.com",
"role": "Developer"
},
{
"name": "Tapp Network",
"email": "andreia.bohner@tappnetwork.com",
"role": "Developer"
}
],
"description": "Filament Laravel Auditing plugin.",
"homepage": "https://github.com/TappNetwork/filament-auditing",
"keywords": [
"Audit",
"auditing",
"filament",
"laravel",
"tapp network"
],
"support": {
"issues": "https://github.com/TappNetwork/filament-auditing/issues",
"source": "https://github.com/TappNetwork/filament-auditing"
},
"time": "2026-02-02T01:09:16+00:00"
},
{
"name": "textalk/websocket",
"version": "1.5.8",
+71
View File
@@ -0,0 +1,71 @@
<?php
declare(strict_types=1);
use App\Filament\Components\Columns\TextColumn;
use Tapp\FilamentAuditing\Filament\Resources\Audits\AuditResource;
return [
'audits_sort' => [
'column' => 'created_at',
'direction' => 'desc',
],
'is_lazy' => true,
'grouped_table_actions' => false,
/**
* Extending Columns
* --------------------------------------------------------------------------
* In case you need to add a column to the AuditsRelationManager that does
* not already exist in the table, you can add it here, and it will be
* prepended to the table builder.
*/
'audits_extend' => [
'old_values' => [
'class' => TextColumn::class,
'methods' => [
'hidden' => true,
],
],
'new_values' => [
'class' => TextColumn::class,
'methods' => [
'hidden' => true,
],
],
],
'custom_audits_view' => false,
'custom_view_parameters' => [
],
'mapping' => [
],
'resources' => [
'AuditResource' => AuditResource::class,
],
'tenancy' => [
// Enable tenancy support
'enabled' => false,
// The Tenant model class (e.g., App\Models\Team::class, App\Models\Organization::class)
'model' => null,
// The tenant relationship name (defaults to snake_case of tenant model class name)
// For example: Team::class -> 'team', Organization::class -> 'organization'
// This should match what you configure in your Filament Panel:
// ->tenantOwnershipRelationshipName('team')
'relationship_name' => null,
// The tenant column name (defaults to snake_case of tenant model class name + '_id')
// You can override this if needed
'column' => null,
],
];