Home

Awesome

Access laravel log through Filament admin panel

Log Viewer

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

Features

<br>

Support Filament

<a href="https://github.com/sponsors/danharrin"> <img width="320" alt="filament-logo" src="https://filamentadmin.com/images/sponsor-banner.jpg"> </a> <br>

Installation

You can install the package via composer:

composer require saade/filament-laravel-log

Usage

Just install the package and you're ready to go!

Configuration

You can publish the config file with:

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

This is the contents of the published config file:

<?php

return [
    /**
     * Secure the page behind a custom policy.
     */
    'authorization' => false,

    /**
     * The directory(ies) containing the log files.
     */
    'logsDir' => [
        storage_path('logs'),
    ],

    /**
     * Files to ignore when searching for log files.
     * Accepts wildcards eg: *.log
     */
    'exclude' => [
        //
    ],

    /**
     * Navigation group.
     */
    'navigationGroup' => 'System',

    /**
     * Navigation sort.
     */
    'navigationSort' => 1,

    /**
     * Navigation icon.
     */
    'navigationIcon' => 'heroicon-o-document-text',

    /**
     * Navigation label.
     */
    'navigationLabel' => 'Logs',

    /**
     * Navigation slug.
     */
    'slug' => 'system-logs',

    /**
     * Maximum amount of lines that editor will render.
     */
    'maxLines' => 50,

    /**
     * Minimum amount of lines that editor will render.
     */
    'minLines' => 10,

    /**
     * Editor font size.
     */
    'fontSize' => 12
];

Authorization

If you would like to prevent certain users from accessing your page, you should enable authorization in config

// config/filament-laravel-log.php

<?php
return [
    /**
     * Secure the page behind a custom policy.
     */
    'authorization' => true,
];

and register an authorization callback inside of a ServiceProvider::boot() method.

// app/Providers/AppServiceProvider.php

<?php

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

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.