To customize the tab title for the audits relation manager when using TappNetwork/filament-auditing, you’ll need to override the default relation manager class, since, by default, the package registers its own and it is not published to your app/Filament directory.
Here’s how you can achieve this:
1. Create Your Own Relation Manager
First, generate a new Relation Manager for the audits relationship in your resource. For example, if you have a PostResource:
php artisan make:FilamentRelationManager PostResource audits
This will create a file at:
app/Filament/Resources/PostResource/RelationManagers/AuditsRelationManager.php
2. Customize the Table Heading
Inside this file, override the getTableHeading method:
<?php
namespace App\Filament\Resources\PostResource\RelationManagers;
use Filament\Resources\RelationManagers\RelationManager;
class AuditsRelationManager extends RelationManager
{
protected static string $relationship = 'audits';
// ...existing code...
protected function getTableHeading(): ?string
{
return 'Audit Trail';
}
}
3. Register Your Relation Manager in the Resource
In your PostResource.php (in the getRelations method), make sure to use your own relation manager:
use App\Filament\Resources\PostResource\RelationManagers\AuditsRelationManager;
// ...
public static function getRelations(): array
{
return [
AuditsRelationManager::class,
];
}
4. Remove the Package's Default Relation Manager
If you previously referenced the package's built-in audits relation manager in your resource, remove it. Only keep your custom one.
Note
There is currently no way to customize this from a config file or by publishing package stubs; you must create your own relation manager as shown above.
In summary:
Override the audits relation manager in your resource, and you can change the table/tab title to "Audit Trail" or any title you wish.
Let me know if you need more help!