Skip to content

Commit 9f2f673

Browse files
authored
Update Actionable.php
1 parent 2692957 commit 9f2f673

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/Traits/Actionable.php

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,20 @@ private static function insertActionMonitoring(mixed $model, string $actionType)
7373
'browser_name' => $detector->getBrowser(),
7474
'platform' => $detector->getDevice(),
7575
'device' => $detector->getDevice(),
76-
'ip' => config('user-monitoring.use_reverse_proxy_ip')
77-
? request()->header(config('user-monitoring.real_ip_header'))
78-
?: request()->ip()
79-
?: request()->ip()
80-
: request()->ip(),,
76+
'ip' => $this->getRealIP(),
8177
'page' => request()->url(),
8278
'created_at' => now(),
8379
'updated_at' => now(),
8480
]);
8581
}
82+
83+
/**
84+
* Get real ip.
85+
*/
86+
private function getRealIP(): string
87+
{
88+
return config('user-monitoring.use_reverse_proxy_ip')
89+
? request()->header(config('user-monitoring.real_ip_header')) ?: request()->ip() ?: request()->ip()
90+
: request()->ip();
91+
}
8692
}

0 commit comments

Comments
 (0)