|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace SimpleCMS\Company\Models; |
|
4
|
|
|
|
|
5
|
|
|
use Carbon\Carbon; |
|
6
|
|
|
use Illuminate\Database\Eloquent\Model; |
|
7
|
|
|
use SimpleCMS\Framework\Traits\PrimaryKeyUuidTrait; |
|
8
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory; |
|
9
|
|
|
|
|
10
|
|
|
/** |
|
11
|
|
|
* 请求日志 |
|
12
|
|
|
* |
|
13
|
|
|
* @author Dennis Lui <[email protected]> |
|
14
|
|
|
* @property string $id 主键 |
|
15
|
|
|
* @property ?string $company_id 企业ID |
|
16
|
|
|
* @property ?string $company_account_id 账号ID |
|
17
|
|
|
* @property ?string $name 说明 |
|
18
|
|
|
* @property ?string $ip_address IP |
|
19
|
|
|
* @property ?array $user_agent UserAgent |
|
20
|
|
|
* @property string $method 请求方法 |
|
21
|
|
|
* @property string $url 请求地址 |
|
22
|
|
|
* @property ?array $parameters 请求参数 |
|
23
|
|
|
* @property string $route_name 路由别名 |
|
24
|
|
|
* @property bool $status 请求状态 |
|
25
|
|
|
* @property-read Carbon $created_at 发生时间 |
|
26
|
|
|
* @property-read ?Company $company 企业 |
|
27
|
|
|
* @property-read ?CompanyAccount $account 账号 |
|
28
|
|
|
*/ |
|
29
|
|
|
class CompanyLog extends Model |
|
30
|
|
|
{ |
|
31
|
|
|
use HasFactory, PrimaryKeyUuidTrait; |
|
32
|
|
|
|
|
33
|
|
|
/** |
|
34
|
|
|
* 删除更新时间 |
|
35
|
|
|
*/ |
|
36
|
|
|
const UPDATED_AT = null; |
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* 可输入字段 |
|
40
|
|
|
*/ |
|
41
|
|
|
protected $fillable = [ |
|
42
|
|
|
'id', |
|
43
|
|
|
'company_id', |
|
44
|
|
|
'company_account_id', |
|
45
|
|
|
'name', |
|
46
|
|
|
'ip_address', |
|
47
|
|
|
'user_agent', |
|
48
|
|
|
'method', |
|
49
|
|
|
'url', |
|
50
|
|
|
'parameters', |
|
51
|
|
|
'route_name', |
|
52
|
|
|
'status' |
|
53
|
|
|
]; |
|
54
|
|
|
|
|
55
|
|
|
/** |
|
56
|
|
|
* 显示字段类型 |
|
57
|
|
|
*/ |
|
58
|
|
|
public $casts = [ |
|
59
|
|
|
'user_agent' => 'array', |
|
60
|
|
|
'parameters' => 'array', |
|
61
|
|
|
'created_at' => 'datetime', |
|
62
|
|
|
'updated_at' => 'datetime', |
|
63
|
|
|
'status' => 'boolean' |
|
64
|
|
|
]; |
|
65
|
|
|
|
|
66
|
|
|
/** |
|
67
|
|
|
* 隐藏关系 |
|
68
|
|
|
*/ |
|
69
|
|
|
public $hidden = []; |
|
70
|
|
|
|
|
71
|
|
|
/** |
|
72
|
|
|
* 企业 |
|
73
|
|
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo |
|
74
|
|
|
*/ |
|
75
|
|
|
public function company() |
|
76
|
|
|
{ |
|
77
|
|
|
return $this->belongsTo(Company::class); |
|
78
|
|
|
} |
|
79
|
|
|
|
|
80
|
|
|
/** |
|
81
|
|
|
* 操作账号 |
|
82
|
|
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo |
|
83
|
|
|
*/ |
|
84
|
|
|
public function account() |
|
85
|
|
|
{ |
|
86
|
|
|
return $this->belongsTo(CompanyAccount::class); |
|
87
|
|
|
} |
|
88
|
|
|
} |
|
89
|
|
|
|