noxoua / filament-activity-log

Add-on for simplified activity logging based on spatie package.
http://activity-log.noxo.app/
MIT License
66 stars 14 forks source link

add support for loggers with diffrente admin panels #63

Closed xdiegom closed 8 months ago

xdiegom commented 9 months ago

Some loggers may be needed only for specific filament admin panels rather than the default filament admin panel.

When loggers are created using php artisan make:filament-logger and having more than one panel, it asks where to create it, thus when trying to access the logger, this is not resolved because the directory and namespace are setup in config file only for the default admin panl.

noxoua commented 8 months ago

There's no need to set up loggers for every panel at the same time. It's better to set up loggers just for the panel you are using. Here's a simple way to do this in filament boot method:

public function panel(Panel $panel): Panel
{
    return $panel
        // ...
        ->bootUsing(function (Panel $panel) {
            config([
                'filament-activity-log.loggers.directory' => app_path('Filament/Loggers'),
                'filament-activity-log.loggers.namespace' => 'App\\Filament\\Loggers',
            ]);
        });
}