AuditRecordTransformer.php
1.5 KB
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
37
38
39
40
41
42
<?php
/**
+-----------------------------------------------------------------------------------------------------------------------
* 数据转换层: 审核日志转换类
+-----------------------------------------------------------------------------------------------------------------------
*
* @copyright Copyright
* @author Richer
* @package App\Transformers
* @version 2019年11月16日,12:33:51
* @link
*/
namespace App\Transformers\System;
use App\Models\System\AuditRecord;
use App\Transformers\BaseTransformer;
use Illuminate\Support\Arr;
class AuditRecordTransformer extends BaseTransformer
{
public function transform(AuditRecord $model)
{
return [
'id' => (int) $model->id,
/* place your other model properties here */
'user_id' => (int)$model->user_id,
'user_name' => (string)$model->user->name,
'user_type' => (string)$model->user_type,
'auditable_type' => (string)$model->auditable_type,
'auditable_id' => (int)$model->auditable_id,
'audited_by' => (int)$model->audited_by,
'audited_status' => (int)$model->audited_status,
'audited_status_show' => $model->audited_status_show,
'audited_status_show_color' => $model->audited_status_show_color,
'audited_opinion' => (string)$model->audited_opinion,
'audited_at' => format_date($model->created_at, 'Y-m-d H:i:s'),
];
}
}