spatie / laravel-activitylog

Log activity inside your Laravel app
https://docs.spatie.be/laravel-activitylog
MIT License
5.3k stars 712 forks source link

Log Name Does not Change #1177

Closed andykoe24 closed 1 year ago

andykoe24 commented 1 year ago

Describe the bug Hi,

I am using ActivityLog as a trait in my user model, but it doesn't capture my log name and keeps saving default in my database. Does anyone know how to solve this?

Screenshots If applicable, add screenshots to help explain your problem. image

Versions (please complete the following information)

boryn commented 1 year ago

What happens when you try to specify the logname at the getActivitylogOptions() level?

public function getActivitylogOptions()
{
    return LogOptions::defaults()
                     ->useLogName('system');
}
github-actions[bot] commented 1 year ago

This issue is stale because it has been open 21 days with no activity. Remove stale label or comment or this will be closed in 7 days

rik43 commented 1 year ago

fix this in docs https://spatie.be/docs/laravel-activitylog/v4/advanced-usage/using-multiple-logs

not actual: protected static $logName = 'custom_log_name_for_this_model';

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 21 days with no activity. Remove stale label or comment or this will be closed in 7 days

leecolarelli-tgb commented 2 months ago

Can confirm that useLogName() method on getActivitylogOptions() works correctly for me, whilst adding a property to the model does not.

Docs need updating.

Laravel 11.11 laravel-activitylog 4.8 php 8.3