Laravel-activitylog: Nova Package

Created on 28 Aug 2018  路  11Comments  路  Source: spatie/laravel-activitylog

Would love to see this one in Nova! Specifically for model events. Great package 馃憤

Most helpful comment

All 11 comments

I think it's pretty easy to create a resource yourself to view the activity log in a Nova app.

True, was thinking more of resource-tools but also just realized Nova has Laravel\Nova\Actions\Actionable which would work for that scenario.

@poxin13 point of note, Actionable is a short lived thing for resources.....only 25 are kept at a time. Only here because I went looking for the same thing as you

Thanks @ragingdave - didn't know that. I ended up just creating a model and nova resource that tied to activitylog for this package.

@poxin13
How did you tie the resource and the model so that it can act like Actionable?
My issue with Actionable is that the "target" is always empty and it doesn't retain the previous value that was changed. Someone suggested this package but it seems freek won't be turning this into a component....

I think it's pretty easy to create a resource yourself to view the activity log in a Nova app.

1) Copy vendor/spatie/laravel-activitylog/src/Models/Activity.php to your models folder (app/ for example)
2) Correct namespace in top of the file
3) Publish config file by php artisan vendor:publish --provider="Spatie\Activitylog\ActivitylogServiceProvider" --tag="config"
4) Edit activity_model option in that config file
5) Do all the stuff as you normally to create Nove resource.

@michaelradionov do not copy it, just create a custom one and extend the package model. This way you don't have to copy changes everytime but only do your custom code.

@Gummibeer, yeah, right

1) Create a model
2) Extend your model with vendor/spatie/laravel-activitylog/src/Models/Activity.php
2) Publish config file by php artisan vendor:publish --provider="Spatie\Activitylog\ActivitylogServiceProvider" --tag="config"
3) Fill activity_model option in that config file with your model path
4) Do all the stuff as you normally do to create Nova resource.

Thx for good tools,i use it in my Nova project.
How can I only use activitylog in Nova admin actions, but not front user action? Any one have idea?

Thx for good tools,i use it in my Nova project.
How can I only use activitylog in Nova admin actions, but not front user action? Any one have idea?

I find a solution, set the global config ACTIVITY_LOGGER_ENABLED to false first, and add this code to NovaServiceProvider.php boot method:

Nova::serving(function () {
    activity()->enableLogging();
});

When I have time, I will consider making a Nova package.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

marky291 picture marky291  路  4Comments

TheFrankman picture TheFrankman  路  5Comments

damosse31 picture damosse31  路  5Comments

abdosaeedelhassan picture abdosaeedelhassan  路  4Comments

farshadff picture farshadff  路  4Comments