1
0
mirror of https://github.com/freescout-helpdesk/freescout.git synced 2025-01-31 20:11:38 +01:00

Helper::getClientIp() function

This commit is contained in:
FreeScout 2023-07-15 23:20:47 -07:00
parent 9266e5c207
commit 2b9f56b456

View File

@ -1890,4 +1890,17 @@ class Helper
ini_set('pcre.backtrack_limit', 1000000000); ini_set('pcre.backtrack_limit', 1000000000);
} }
} }
/**
* Get client IP address.
*/
public static function getClientIp()
{
// Fix for CloudFlare: https://laracasts.com/discuss/channels/laravel/cloudflare-and-user-ip
// But if CloudFlare is not used any value can be set to "Cf-Connecting-Ip" header.
// if (isset($_SERVER["HTTP_CF_CONNECTING_IP"])) {
// $_SERVER['REMOTE_ADDR'] = $_SERVER["HTTP_CF_CONNECTING_IP"];
// }
return request()->ip();
}
} }