@@ -32,7 +32,7 @@ public static function activity($description = null, $details = null)
32
32
if (Crawler::isCrawler ()) {
33
33
$ userType = trans ('LaravelLogger::laravel-logger.userTypes.crawler ' );
34
34
if (is_null ($ description )) {
35
- $ description = $ userType. ' ' . trans ('LaravelLogger::laravel-logger.verbTypes.crawled ' ). ' ' . Request::fullUrl ();
35
+ $ description = $ userType . ' ' . trans ('LaravelLogger::laravel-logger.verbTypes.crawled ' ) . ' ' . Request::fullUrl ();
36
36
}
37
37
}
38
38
@@ -57,7 +57,15 @@ public static function activity($description = null, $details = null)
57
57
break ;
58
58
}
59
59
60
- $ description = $ verb .' ' .Request::path ();
60
+ $ description = $ verb . ' ' . Request::path ();
61
+ }
62
+
63
+ if (isset ($ _SERVER ["HTTP_CF_CONNECTING_IP " ])) {
64
+ $ ip = $ _SERVER ["HTTP_CF_CONNECTING_IP " ];
65
+ } elseif (isset ($ _SERVER ["HTTP_X_FORWARDED_FOR " ])) {
66
+ $ ip = $ _SERVER ["HTTP_X_FORWARDED_FOR " ];
67
+ } else {
68
+ $ ip = Request::ip ();
61
69
}
62
70
63
71
$ data = [
@@ -66,7 +74,7 @@ public static function activity($description = null, $details = null)
66
74
'userType ' => $ userType ,
67
75
'userId ' => $ userId ,
68
76
'route ' => Request::fullUrl (),
69
- 'ipAddress ' => Request:: ip () ,
77
+ 'ipAddress ' => $ ip ,
70
78
'userAgent ' => Request::header ('user-agent ' ),
71
79
'locale ' => Request::header ('accept-language ' ),
72
80
'referer ' => Request::header ('referer ' ),
@@ -78,7 +86,7 @@ public static function activity($description = null, $details = null)
78
86
if ($ validator ->fails ()) {
79
87
$ errors = self ::prepareErrorMessage ($ validator ->errors (), $ data );
80
88
if (config ('LaravelLogger.logDBActivityLogFailuresToFile ' )) {
81
- Log::error ('Failed to record activity event. Failed Validation: ' . $ errors );
89
+ Log::error ('Failed to record activity event. Failed Validation: ' . $ errors );
82
90
}
83
91
} else {
84
92
self ::storeActivity ($ data );
0 commit comments