Completed
Push — master ( 3f2c58...3eb51e )
by wen
02:00
created

WebHandler::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
4
namespace Sco\ActionLog\Handlers;
5
6
use Sco\ActionLog\LogInfo;
7
use Sco\ActionLog\Traits\HasAttributes;
8
9
class WebHandler extends AbstractHandler
10
{
11
    use HasAttributes;
12
13
    public function __construct(array $attributes)
14
    {
15
        $this->setAttribute($attributes);
16
    }
17
18
    public function info()
19
    {
20
        return new LogInfo([
21
            'type'       => $this->getAttribute('type', 'web'),
22
            'table_name' => $this->getAttribute('table_name', ''),
23
            'content'    => $this->getAttribute('content', ''),
24
            'client_ip'  => request()->getClientIp(),
25
            'client'     => $this->getClient(),
26
            'user_id'    => intval(Auth::id()),
27
        ]);
28
    }
29
}
30