ryangjchandler/filament-log

A simplistics log viewer for your Filament apps.

This package's canonical repository appears to be gone and the package has been frozen as a result.

v0.2.1 2022-11-10 18:09 UTC

README

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

This package provides a Logs page that allows you to view your Laravel log files in a simple UI.

Installation

You can install the package via Composer:

composer require ryangjchandler/filament-log

You can publish the config file with:

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

Optionally, you can publish the views using

php artisan vendor:publish --tag="filament-log-views"

This is the contents of the published config file:

return [

    'pages' => [
        RyanChandler\FilamentLog\Logs::class,
    ],

    'paths' => [
        storage_path('logs')
    ],

];

Usage

You should first publish the assets provided by this plugin:

php artisan vendor:publish --tag=filament-log-assets

This will publish the CSS files to public/vendor/filament-log.

The Logs page will be automatically registed with Filament and appear in your panel.

Authorization

If you would like to prevent certain users from accessing your page, you should register an authorization callback inside of a ServiceProvider::boot() method.

public function boot()
{
    Logs::can(function (User $user) {
        return $user->role === Role::Admin;
    });
}

This will prevent the navigation item from being registered.

Further customization

If you would like to customize the Logs page, you can do so by extending the package's page e.g.

class Logs extends \RyanChandler\FilamentLog\Logs
{
    protected static ?string $navigationGroup = 'System';
    
    protected static ?int $navigationSort = 10;
    
    protected static ?string $slug = 'system/logs';
}

You should now register your own page in the filament-log config file:

'pages' => [
    App\Filament\Pages\Logs::class,
],

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.