Skip to content

Commit 8113d43

Browse files
authored
Merge pull request #44 from binafy/add-custom-attribute-for-user-name
[1.x] Add custom attribute for user name
2 parents d971052 + c6108db commit 8113d43

File tree

4 files changed

+8
-3
lines changed

4 files changed

+8
-3
lines changed

config/user-monitoring.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@
4242
* When you are using ulid or uuid, you need to add related traits into the models.
4343
*/
4444
'foreign_key_type' => 'id', // uuid, ulid, id
45+
46+
/*
47+
* If you want to display custom username, you can create your own attribute in User and change this value.
48+
*/
49+
'display_attribute' => 'name',
4550
],
4651

4752
/*

resources/views/actions-monitoring/index.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<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" />
2222
</svg>
2323
<p class="text-sm leading-none text-gray-600 ml-2">
24-
{{ $action->user->name ?? 'Guest User' }}
24+
{{ $action->user->{config('user-monitoring.user.display_attribute')} ?? 'Guest User' }}
2525
</p>
2626
</div>
2727
</td>

resources/views/authentications-monitoring/index.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<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" />
1515
</svg>
1616
<p class="text-sm leading-none text-gray-600 ml-2">
17-
{{ $authentication->user->name ?? 'Guest User' }}
17+
{{ $authentication->user->{config('user-monitoring.user.display_attribute')} ?? 'Guest User' }}
1818
</p>
1919
</div>
2020
</td>

resources/views/visits-monitoring/index.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<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" />
2222
</svg>
2323
<p class="text-sm leading-none text-gray-600 ml-2">
24-
{{ $visit->user->name ?? 'Guest User' }}
24+
{{ $visit->user->{config('user-monitoring.user.display_attribute')} ?? 'Guest User' }}
2525
</p>
2626
</div>
2727
</td>

0 commit comments

Comments
 (0)