| Conditions | 5 |
| Paths | 5 |
| Total Lines | 21 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 1 | Features | 1 |
| 1 | <?php |
||
| 27 | public function info(LogInfo $info) |
||
| 28 | { |
||
| 29 | $log = new ActionLogModel(); |
||
| 30 | |||
| 31 | if (!$info->getUserId() && !config('actionlog.guest')) { |
||
| 32 | return false; |
||
| 33 | } |
||
| 34 | |||
| 35 | $content = $info->getContent(); |
||
| 36 | $client = $info->getClient(); |
||
| 37 | |||
| 38 | $log->user_id = $info->getUserId(); |
||
| 39 | $log->type = $info->getType(); |
||
| 40 | $log->table_name = $info->getTableName(); |
||
| 41 | $log->content = is_string($content) ? $content : json_encode($content); |
||
| 42 | $log->client_ip = $info->getClientIp(); |
||
| 43 | $log->client = is_string($client) ? $client : json_encode($client); |
||
| 44 | $log->save(); |
||
| 45 | |||
| 46 | return true; |
||
| 47 | } |
||
| 48 | |||
| 61 |