2db47680
hexiaodong
chore: 初始提交 php 遗...
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
<?php
namespace addons\exam\model;
class CertModel extends \app\admin\model\exam\CertModel
{
// 追加属性
protected $append = [
'status_text',
'image',
'create_time_text',
];
public function getImageAttr($value, $data)
{
$value = $data['image'] ?? $value;
return cdnurl($value, true);;
}
public function getCreateTimeTextAttr($value, $data)
{
$value = $value ?: ($data['createtime'] ?? '');
return is_numeric($value) ? date('Y-m-d H:i:s', $value) : $value;
}
public function paper()
{
return $this->belongsTo(PaperModel::class, 'paper_id');
}
public function room()
{
return $this->belongsTo(RoomModel::class, 'room_id');
}
}
|