| Conditions | 5 |
| Paths | 12 |
| Total Lines | 26 |
| Code Lines | 19 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 21 | public function handle($request, Closure $next, $guard = '') |
||
| 22 | { |
||
| 23 | $data = []; |
||
| 24 | if ($guard !== '') { |
||
| 25 | $user = Auth::guard($guard)->user(); |
||
| 26 | if ($user) { |
||
| 27 | $data['user_id'] = $user->id; |
||
|
|
|||
| 28 | $data['user_name'] = $user->name; |
||
| 29 | } |
||
| 30 | } |
||
| 31 | $data['url'] = $request->url(); |
||
| 32 | $data['ua'] = $request->userAgent(); |
||
| 33 | $data['ip'] = (string) $request->getClientIp(); |
||
| 34 | $input = $request->all(); |
||
| 35 | if (isset($input['password'])) { |
||
| 36 | $input['password'] = '******'; |
||
| 37 | } |
||
| 38 | $data['data'] = Query::build($input, false); |
||
| 39 | |||
| 40 | if (config('light.log_async_write')) { |
||
| 41 | $data['updated_at'] = $data['created_at'] = Carbon::now(); |
||
| 42 | dispatch(new WriteSystemLog($data)); |
||
| 43 | } else { |
||
| 44 | LogRepository::add($data); |
||
| 45 | } |
||
| 46 | return $next($request); |
||
| 47 | } |
||
| 49 |