Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1.x] Add custom attribute for user name #44

Merged
merged 2 commits into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions config/user-monitoring.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@
* When you are using ulid or uuid, you need to add related traits into the models.
*/
'foreign_key_type' => 'id', // uuid, ulid, id

/*
* If you want to display custom username, you can create your own attribute in User and change this value.
*/
'display_attribute' => 'name',
],

/*
Expand Down
2 changes: 1 addition & 1 deletion resources/views/actions-monitoring/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<path stroke-linecap="round" stroke-linejoin="round" d="M17.982 18.725A7.488 7.488 0 0012 15.75a7.488 7.488 0 00-5.982 2.975m11.963 0a9 9 0 10-11.963 0m11.963 0A8.966 8.966 0 0112 21a8.966 8.966 0 01-5.982-2.275M15 9.75a3 3 0 11-6 0 3 3 0 016 0z" />
</svg>
<p class="text-sm leading-none text-gray-600 ml-2">
{{ $action->user->name ?? 'Guest User' }}
{{ $action->user->{config('user-monitoring.user.display_attribute')} ?? 'Guest User' }}
</p>
</div>
</td>
Expand Down
2 changes: 1 addition & 1 deletion resources/views/authentications-monitoring/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<path stroke-linecap="round" stroke-linejoin="round" d="M17.982 18.725A7.488 7.488 0 0012 15.75a7.488 7.488 0 00-5.982 2.975m11.963 0a9 9 0 10-11.963 0m11.963 0A8.966 8.966 0 0112 21a8.966 8.966 0 01-5.982-2.275M15 9.75a3 3 0 11-6 0 3 3 0 016 0z" />
</svg>
<p class="text-sm leading-none text-gray-600 ml-2">
{{ $authentication->user->name ?? 'Guest User' }}
{{ $authentication->user->{config('user-monitoring.user.display_attribute')} ?? 'Guest User' }}
</p>
</div>
</td>
Expand Down
2 changes: 1 addition & 1 deletion resources/views/visits-monitoring/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<path stroke-linecap="round" stroke-linejoin="round" d="M17.982 18.725A7.488 7.488 0 0012 15.75a7.488 7.488 0 00-5.982 2.975m11.963 0a9 9 0 10-11.963 0m11.963 0A8.966 8.966 0 0112 21a8.966 8.966 0 01-5.982-2.275M15 9.75a3 3 0 11-6 0 3 3 0 016 0z" />
</svg>
<p class="text-sm leading-none text-gray-600 ml-2">
{{ $visit->user->name ?? 'Guest User' }}
{{ $visit->user->{config('user-monitoring.user.display_attribute')} ?? 'Guest User' }}
</p>
</div>
</td>
Expand Down