CompanySafe   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 22
c 1
b 0
f 0
dl 0
loc 43
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A account() 0 3 1
1
<?php
2
3
namespace SimpleCMS\Company\Models;
4
5
use Carbon\Carbon;
6
use Illuminate\Database\Eloquent\Model;
7
use Illuminate\Database\Eloquent\Factories\HasFactory;
8
9
/**
10
 * CompanySafe Model
11
 * @author Dennis Lui <[email protected]>
12
 *
13
 * @property string $id 主键
14
 * @property string $company_account_id 账号ID
15
 * @property string $type 类型
16
 * @property string $account 登录账号
17
 * @property ?string $code 名称
18
 * @property bool $is_verified 权限
19
 * @property ?Carbon $verified_at 密码
20
 * @property ?Carbon $valid_at 是否可用
21
 * @property ?string $verified_ip 是否管理员
22
 * @property ?string $verified_finger 最后登录时间
23
 * @property-read ?Carbon $created_at 创建时间
24
 * @property-read ?Carbon $updated_at 更新时间
25
 * @property-read ?CompanyAccount $account 登录账号
26
 */
27
class CompanySafe extends Model
28
{
29
    use HasFactory;
30
31
    /**
32
     * 可输入字段
33
     */
34
    protected $fillable = [
35
        'id',
36
        'company_account_id',
37
        'type',
38
        'account',
39
        'code',
40
        'is_verified',
41
        'verified_at',
42
        'valid_at',
43
        'verified_ip',
44
        'verified_finger',
45
    ];
46
    /**
47
     * 显示字段类型
48
     */
49
    public $casts = [
50
        'is_verified' => 'boolean',
51
        'verified_at' => 'datetime',
52
        'valid_at' => 'datetime',
53
        'created_at' => 'datetime',
54
        'updated_at' => 'datetime'
55
    ];
56
57
    /**
58
     * 追加字段
59
     */
60
    public $appends = [];
61
62
    /**
63
     * 隐藏关系
64
     */
65
    public $hidden = [];
66
67
    public function account()
68
    {
69
        return $this->belongsTo(CompanyAccount::class);
70
    }
71
72
}
73