Skip to content

Commit 7bb7bf8

Browse files
authored
Merge pull request #36 from CyberEkklesiaOwner/main
Configurable user model
2 parents 8f8418a + fde1432 commit 7bb7bf8

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ No breaking changes. The only changes are to the development dependencies used f
1717

1818
## Changes
1919

20+
- Add config for which model to use in the `RequestLog` models `user()` relationship
21+
2022
### 3.2.0
2123

2224
- Add Laravel 11 compatibility

config/request-logger.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,17 @@
7878
'Authorization',
7979
'filter.search',
8080
],
81+
82+
/*
83+
|--------------------------------------------------------------------------
84+
| User Model
85+
|--------------------------------------------------------------------------
86+
|
87+
| This is the model used for user relationships.
88+
| You can set a custom user model for relationships.
89+
|
90+
| Leaving this empty will use the model from the 'users' auth provider.
91+
|
92+
*/
93+
'user_model' => env('REQUEST_LOGGER_USER_MODEL'),
8194
];

src/Models/RequestLog.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class RequestLog extends Model implements RequestLoggerInterface
6969

7070
public function user(): BelongsTo
7171
{
72-
return $this->belongsTo(config('auth.providers.users.model'));
72+
return $this->belongsTo(config('request-logger.user_model') ?? config('auth.providers.users.model'));
7373
}
7474

7575
public function team(): BelongsTo

0 commit comments

Comments
 (0)