Skip to content
A tool to activity logger to monitor the users of your Laravel Nova.
Branch: master
Clone or download
Latest commit 8a425e8 Mar 13, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
dist init Mar 7, 2019
docs update screenshot Mar 7, 2019
resources
routes
src
.editorconfig add README Mar 7, 2019
.gitignore add README Mar 7, 2019
.php_cs
LICENSE Initial commit Mar 7, 2019
README.md
composer.json
package.json init Mar 7, 2019
webpack.mix.js init Mar 7, 2019
yarn.lock

README.md

Nova tool for activity log

StyleCI Latest Stable Version License

A tool to activity logger to monitor the users of your Laravel Nova.

screenshot

Installation

You can install the package in to a Laravel app that uses Nova via composer:

composer require bolechen/nova-activitylog

You can publish the migration with:

php artisan vendor:publish --provider="Spatie\Activitylog\ActivitylogServiceProvider" --tag="migrations"

Note: The default migration assumes you are using integers for your model IDs. If you are using UUIDs, or some other format, adjust the format of the subject_id and causer_id fields in the published migration before continuing.

After publishing the migration you can create the activity_log table by running the migrations:

php artisan migrate

You can optionally publish the config file with:

php artisan vendor:publish --provider="Spatie\Activitylog\ActivitylogServiceProvider" --tag="config"

How to use

Next up, you must register the tool with Nova. This is typically done in the tools method of the NovaServiceProvider.

// in app/Providers/NovaServiceProvder.php

// ...

public function tools()
{
    return [
        // ...
        new \Bolechen\NovaActivitylog\NovaActivitylog(),
    ];
}

Because backend we use the spatie/laravel-activitylog package, you need to do is let your model use the Spatie\Activitylog\Traits\LogsActivity trait.

Here's an example:

use Illuminate\Database\Eloquent\Model;
use Spatie\Activitylog\Traits\LogsActivity;

class NewsItem extends Model
{
    use LogsActivity;

    protected $fillable = ['name', 'text'];
    
    protected static $logAttributes = ['name', 'text'];
}

For more advanced usage can look at the doc: https://docs.spatie.be/laravel-activitylog/v3/advanced-usage/logging-model-events

License

The MIT License (MIT). Please see License File for more information.

You can’t perform that action at this time.