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

Configurable User Model missing code #35

Merged
merged 3 commits into from
May 10, 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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ No breaking changes. The only changes are to the development dependencies used f

## Changes

- Add config for which model to use in the `RouteStatistic` models `user()` relationship

### 3.3.0 - 2024-05-07

- Add second-level aggregation and make sure that microseconds is always set to 0
Expand Down
13 changes: 13 additions & 0 deletions config/route-statistics.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,17 @@
|
*/
'queued' => env('ROUTE_STATISTICS_QUEUED', false),

/*
|--------------------------------------------------------------------------
| User Model
|--------------------------------------------------------------------------
|
| This is the model used for user relationships.
| You can set a custom user model for relationships.
|
| Leaving this empty will use the model from the 'users' auth provider.
|
*/
'user_model' => env('ROUTE_STATISTICS_USER_MODEL'),
];
2 changes: 1 addition & 1 deletion src/Models/RouteStatistic.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function scopeWhereWeb(Builder $query): Builder

public function user(): BelongsTo
{
return $this->belongsTo(config('auth.providers.users.model'));
return $this->belongsTo(config('route-statistics.user_model') ?? config('auth.providers.users.model'));
}

public function team(): BelongsTo
Expand Down
Loading