diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php index b593ea26..9eeb2400 100644 --- a/app/Http/Kernel.php +++ b/app/Http/Kernel.php @@ -36,6 +36,7 @@ class Kernel extends HttpKernel \Illuminate\View\Middleware\ShareErrorsFromSession::class, \App\Http\Middleware\VerifyCsrfToken::class, \Illuminate\Routing\Middleware\SubstituteBindings::class, + \App\Http\Middleware\SentryUser::class ], 'api' => [ diff --git a/app/Http/Middleware/SentryUser.php b/app/Http/Middleware/SentryUser.php new file mode 100644 index 00000000..5ad0567b --- /dev/null +++ b/app/Http/Middleware/SentryUser.php @@ -0,0 +1,33 @@ +bound('sentry')) { + \Sentry\configureScope(function (Scope $scope): void { + $scope->setUser([ + 'id' => Auth::user()->id, + 'email' => Auth::user()->email, + 'name' => Auth::user()->full_name, + ]); + }); + } + + return $next($request); + } +}