| Conditions | 3 |
| Paths | 2 |
| Total Lines | 20 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 2 | Features | 1 |
| 1 | <?php |
||
| 18 | { |
||
| 19 | $log = new ActionLogModel(); |
||
| 20 | |||
| 21 | if (!$info->getUserId() && !config('actionlog.guest')) { |
||
| 22 | return false; |
||
| 23 | } |
||
| 24 | |||
| 25 | $content = $info->getContent(); |
||
| 26 | $client = $info->getClient(); |
||
| 27 | |||
| 28 | $log->user_id = $info->getUserId(); |
||
| 29 | $log->type = $info->getType(); |
||
| 30 | $log->table_name = $info->getTableName(); |
||
| 31 | $log->content = is_string($content) ? $content : json_encode($content); |
||
| 32 | $log->client_ip = $info->getClientIp(); |
||
| 33 | $log->client = is_string($client) ? $client : json_encode($client); |
||
| 34 | $log->save(); |
||
| 35 | |||
| 36 | return true; |
||
| 37 | } |
||
| 38 | |||
| 51 |