Skip to content
This repository has been archived by the owner on Nov 29, 2021. It is now read-only.

Commit

Permalink
support additional fields for user context (#59)
Browse files Browse the repository at this point in the history
support additional fields for user context
  • Loading branch information
philkra authored Aug 12, 2019
2 parents 5d944ca + f100cc1 commit b8d05f6
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Middleware/RecordTransaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,13 @@ public function handle($request, Closure $next)
'headers' => $this->formatHeaders($response->headers->all()),
]);

$user = $request->user();
$transaction->setUserContext([
'id' => optional($request->user())->id,
'email' => optional($request->user())->email,
'id' => optional($user)->id,
'email' => optional($user)->email,
'username' => optional($user)->user_name,
'ip' => $request->ip(),
'user-agent' => $request->userAgent(),
]);

$transaction->setMeta([
Expand Down

0 comments on commit b8d05f6

Please sign in to comment.