File "SetSentryUserMiddleware.php"
Full Path: /var/www/drive/foundation/src/Core/Middleware/SetSentryUserMiddleware.php
File size: 527 bytes
MIME-type: text/x-php
Charset: utf-8
<?php
namespace Common\Core\Middleware;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Sentry\State\Scope;
use function Sentry\configureScope;
class SetSentryUserMiddleware
{
public function handle(Request $request, Closure $next)
{
if ($user = Auth::user()) {
configureScope(function (Scope $scope) use ($user) {
$scope->setUser(['email' => $user->email, 'id' => $user->id]);
});
}
return $next($request);
}
}