spatie / laravel-activitylog

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

"tapActivity" method called twice during the model event logging #1308

Closed nazar-linkup closed 3 months ago

nazar-linkup commented 3 months ago

I'm using model events logging and have tapActivity method implementation, and I noticed that tapActivity method called twice.
First time from LogsActivity trait before calling log method on logger instance. And after that in the log method of ActivityLogger class before saving activity model. Is there any idea behind this logic or it's just a mistake?

https://github.com/spatie/laravel-activitylog/blob/3f200321101db15ee0dae90999ebe46969685290/src/Traits/LogsActivity.php#L77-L88

https://github.com/spatie/laravel-activitylog/blob/3f200321101db15ee0dae90999ebe46969685290/src/ActivityLogger.php#L157-L179