spatie / laravel-activitylog

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

Display Username instead of Id #1174

Closed fabzster closed 1 year ago

fabzster commented 1 year ago

Hi

I would like to show the causer_name when retrieving logs instead of the causer_id for display purposes only what is the best way to achieve this?

Kind Regards

itsdwizzy commented 1 year ago

You can just use the relationship method causer() provided in the Spatie\Activitylog\Models\Activity model:

Activity::with('causer')->get();
fabzster commented 1 year ago

thank you so much

On Fri, 17 Mar 2023 at 22:57, Dwayne Boumann @.***> wrote:

You can just use the relationship method causer() provided in the Spatie\Activitylog\Models\Activity model:

Activity::with('causer')->get();

— Reply to this email directly, view it on GitHub https://github.com/spatie/laravel-activitylog/issues/1174#issuecomment-1474395945, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEF4OJD3NWXDDF6677HZQUTW4TF2ZANCNFSM6AAAAAAV3WWMLM . You are receiving this because you authored the thread.Message ID: @.***>

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