-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAuditTrail.php
73 lines (68 loc) · 1.67 KB
/
AuditTrail.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?php
/**
* Created by PhpStorm.
* User: i_s_lutokhin
* Date: 20.07.2015
* Time: 16:47
*/
namespace fwext\AuditTrail;
use Yii;
/**
* This is the model class for table "audit_trail".
*
* @property integer $user_id
* @property integer $user_ip
* @property integer $action_type
* @property string $model
* @property string $model_id
* @property string $field
* @property string $value_old
* @property string $value_new
* @property integer $timestamp
*/
class AuditTrail extends \yii\db\ActiveRecord
{
public static function getActionList()
{
return [
AuditTrailBehavior::ACTION_INSERT => 'СОЗДАНИЕ',
AuditTrailBehavior::ACTION_SET => 'УСТАНОВКА',
AuditTrailBehavior::ACTION_UPDATE => 'ОБНОВЛЕНИЕ',
AuditTrailBehavior::ACTION_DELETE => 'УДАЛЕНИЕ',
];
}
/**
* @inheritdoc
*/
public static function tableName()
{
return 'audit_trail';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['user_id', 'user_ip', 'action_type', 'timestamp'], 'integer'],
[['action_type', 'object', 'object_id', 'timestamp'], 'required'],
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'user_id' => 'User ID',
'user_ip' => 'User Ip',
'action_type' => 'Action Type',
'object' => 'Model',
'object_id' => 'Model ID',
'field' => 'Field',
'value_old' => 'Value Old',
'value_new' => 'Value New',
'timestamp' => 'Timestamp',
];
}
}