| Conditions | 1 |
| Paths | 1 |
| Total Lines | 17 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 13 |
| CRAP Score | 1 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 31 | 6 | public function createLoginLog(): UserLoginLog |
|
| 32 | { |
||
| 33 | 6 | $agent = new Agent(); |
|
| 34 | 6 | $log = new UserLoginLog([ |
|
| 35 | 6 | 'ip' => request()->ip(), |
|
| 36 | 6 | 'device' => $agent->device(), |
|
| 37 | 6 | 'platform' => $agent->platform(), |
|
| 38 | 6 | 'browser' => $agent->browser(), |
|
| 39 | 6 | 'device_type' => DeviceType::getValue($agent), |
|
| 40 | 6 | 'login_at' => Carbon::now(), |
|
| 41 | ]); |
||
| 42 | |||
| 43 | 6 | $log->platform_version = $agent->version($log->platform); |
|
| 44 | 6 | $log->browser_version = $agent->version($log->browser); |
|
| 45 | |||
| 46 | 6 | $this->loginLogs()->save($log); |
|
| 47 | 6 | return $log; |
|
| 48 | } |
||
| 55 |