Skip to content

Commit 70633b3

Browse files
authored
Merge pull request #67 from grantholle/type-issue
Move logic to before determining user agent
2 parents 4983cc5 + 4f50ef4 commit 70633b3

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/Http/Middleware/Analytics.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,16 @@ public function handle(Request $request, Closure $next)
2828
return $response;
2929
}
3030

31+
foreach (config('analytics.exclude', []) as $except) {
32+
if ($except !== '/') {
33+
$except = trim($except, '/');
34+
}
35+
36+
if ($request->fullUrlIs($except) || $request->is($except)) {
37+
return $response;
38+
}
39+
}
40+
3141
$agent = new Agent();
3242
if ($userAgent = $request->headers->get('user-agent')) {
3343
$agent->setUserAgent($userAgent);
@@ -49,16 +59,6 @@ public function handle(Request $request, Closure $next)
4959
}
5060
}
5161

52-
foreach (config('analytics.exclude', []) as $except) {
53-
if ($except !== '/') {
54-
$except = trim($except, '/');
55-
}
56-
57-
if ($request->fullUrlIs($except) || $request->is($except)) {
58-
return $response;
59-
}
60-
}
61-
6262
$attributes = [
6363
'session' => $this->getSessionProvider()->get($request),
6464
'uri' => $uri,

0 commit comments

Comments
 (0)