Skip to content

Commit

Permalink
Merge pull request #44 from binafy/add-custom-attribute-for-user-name
Browse files Browse the repository at this point in the history
[1.x] Add custom attribute for user name
  • Loading branch information
milwad-dev authored Sep 19, 2024
2 parents d971052 + c6108db commit 8113d43
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
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

0 comments on commit 8113d43

Please sign in to comment.