Coder Social home page Coder Social logo

filament-logger's Introduction

Activity logger for filament

Latest Version on Packagist Total Downloads

logger banner

Configurable activity logger for filament. Powered by spatie/laravel-activitylog

Features

You can choose what you want to log and how to log it.

  • Log Filament Resource Events
  • Log Login Event
  • Log Notification Events
  • Log Model Events
  • Easily extendable to log custom events

Note: By default this package will log Filament Resource Events, Access(Login) Events, and Notification Events. If you want to log a model that is not a FilamentResource you will have to manually register in the config file.

Installation

Plugin Version Filament Version
< 0.5.x ^2.11
>= 0.6.0 3.x

This package uses spatie/laravel-activitylog, instructions for its setup can be found here

You can install the package via composer:

composer require z3d0x/filament-logger

After that run the install command:

php artisan filament-logger:install

This will publish the config & migrations from spatie/laravel-activitylog

For Filament v3, you need to register a resource in PanelProvider

public function panel(Panel $panel): Panel
{
    return $panel
        ->resources([
            config('filament-logger.activity_resource')
        ]);
}

Authorization

To enforce policies on ActivityResource, after generating a policy, you would need to register Spatie\Activitylog\Models\Activity to use that policy in the AuthServiceProvider.

<?php
 
namespace App\Providers;
 
use App\Policies\ActivityPolicy;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
use Spatie\Activitylog\Models\Activity;
 
class AuthServiceProvider extends ServiceProvider
{
    protected $policies = [
        // Update `Activity::class` with the one defined in `config/activitylog.php`
        Activity::class => ActivityPolicy::class,
    ];
    //...
}

If you are using Shield just register the ActivityPolicy generated by it

Translations

Publish the translations using:

php artisan vendor:publish --tag="filament-logger-translations"

Activity Model resolution

The main Activity class being used by the Filament Resource instance will be resolved by Spatie's service provider, which loads the model defined by the configuration key found at activitylog.activity_model in config/activitylog.php.

Screenshots

logger-index

logger-detail-1

logger-detail-2

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.

filament-logger's People

Contributors

z3d0x avatar dependabot[bot] avatar github-actions[bot] avatar fsamapoor avatar homaeee avatar ngfw avatar pathros avatar amiraghaee avatar cweagans avatar lakuapik avatar gapfranco avatar thyseus avatar ruswan avatar laravel-shift avatar castellani8 avatar marcoguido avatar marcosmarcolin avatar mnurullahsaglam avatar datlechin avatar nicolasbaud avatar robertorinaldi-dev avatar corean avatar thapaprabhat avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.