Skip to content

Commit

Permalink
Update Actionable.php
Browse files Browse the repository at this point in the history
  • Loading branch information
milwad-dev authored Dec 16, 2024
1 parent 2692957 commit 9f2f673
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/Traits/Actionable.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,20 @@ private static function insertActionMonitoring(mixed $model, string $actionType)
'browser_name' => $detector->getBrowser(),
'platform' => $detector->getDevice(),
'device' => $detector->getDevice(),
'ip' => config('user-monitoring.use_reverse_proxy_ip')
? request()->header(config('user-monitoring.real_ip_header'))
?: request()->ip()
?: request()->ip()
: request()->ip(),,
'ip' => $this->getRealIP(),
'page' => request()->url(),
'created_at' => now(),
'updated_at' => now(),
]);
}

/**
* Get real ip.
*/
private function getRealIP(): string
{
return config('user-monitoring.use_reverse_proxy_ip')
? request()->header(config('user-monitoring.real_ip_header')) ?: request()->ip() ?: request()->ip()
: request()->ip();
}
}

0 comments on commit 9f2f673

Please sign in to comment.