Log exact IP if reported by cloudflare

This commit is contained in:
David Bomba 2021-06-22 10:51:43 +10:00
parent a3a406b122
commit 8f78f93537

View File

@ -55,8 +55,15 @@ class QueryLogging
//nlog($request->method().' - '.urldecode($request->url()).": $count queries - ".$time);
// if($count > 50)
//nlog($queries);
$ip = '';
LightLogs::create(new DbQuery($request->method(), urldecode($request->url()), $count, $time, request()->ip()))
if(request()->header('Cf-Connecting-Ip'))
$ip = request()->header('Cf-Connecting-Ip');
else{
$ip = request()->ip();
}
LightLogs::create(new DbQuery($request->method(), urldecode($request->url()), $count, $time, $ip))
->batch();
}