OrdersAudit.php
1.28 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
namespace common\models;
use Yii;
/**
* This is the model class for table "orders_audit".
*
* @property integer $id
* @property string $email
* @property string $phone
* @property string $comment
* @property integer $created
* @property string $ip
*/
class OrdersAudit extends \yii\db\ActiveRecord
{
/**
* @inheritdoc
*/
public static function tableName()
{
return 'orders_audit';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['phone', 'comment'], 'required'],
[['comment'], 'string'],
[['created'], 'integer'],
[['email', 'phone'], 'string', 'max' => 150],
[['ip'], 'string', 'max' => 15]
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'id' => Yii::t('app', 'ID'),
'email' => Yii::t('app', 'Email'),
'phone' => Yii::t('app', 'Phone'),
'comment' => Yii::t('app', 'Comment'),
'created' => Yii::t('app', 'Created'),
'ip' => Yii::t('app', 'Ip'),
];
}
public function setDefaults() {
$this->ip = Yii::$app->request->getUserIP();
$this->created = time();
}
public function sendEmail($to) {
}
}