Orders.php
3.35 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<?php
namespace backend\models;
use common\models\Customer;
use Yii;
class Orders extends \yii\db\ActiveRecord
{
public $labels;
public static function tableName()
{
return 'orders';
}
public function rules()
{
return [
[
[ 'name' ],
'required',
],
[
[
'user_id',
'adress',
'body',
'total',
'status',
'email',
'comment',
'labels',
'pay',
'date_dedline',
'phone',
'phone2',
'numbercard',
'delivery',
'declaration',
'stock',
'consignment',
'payment',
'insurance',
'amount_imposed',
'shipping_by',
'city',
'date_time',
'id',
],
'safe',
],
];
}
public function attributeLabels()
{
return [
'id' => Yii::t('app', 'orders_id'),
'name' => Yii::t('app', 'orders_name'),
'phone' => Yii::t('app', 'orders_phone'),
'phone2' => Yii::t('app', 'orders_phone2'),
'adress' => Yii::t('app', 'orders_adress'),
'body' => Yii::t('app', 'orders_body'),
'reserve' => Yii::t('app', 'orders_reserve'),
'status' => Yii::t('app', 'orders_status'),
'email' => Yii::t('app', 'orders_email'),
'total' => Yii::t('app', 'orders_total'),
'labels' => Yii::t('app', 'orders_labels'),
'label' => Yii::t('app', 'orders_label'),
'comment' => Yii::t('app', 'orders_comment'),
'date_dedline' => Yii::t('app', 'orders_date_dedline'),
'numbercard' => Yii::t('app', 'orders_numbercard'),
'delivery' => Yii::t('app', 'orders_delivery'),
'declaration' => Yii::t('app', 'orders_declaration'),
'stock' => Yii::t('app', 'orders_stock'),
'consignment' => Yii::t('app', 'orders_consignment'),
'payment' => Yii::t('app', 'orders_payment'),
'insurance' => Yii::t('app', 'orders_insurance'),
'amount_imposed' => Yii::t('app', 'orders_amount_imposed'),
'shipping_by' => Yii::t('app', 'orders_shipping_by'),
'city' => Yii::t('app', 'orders_city'),
'date_time' => Yii::t('app', 'orders_datetime'),
];
}
public function getUser()
{
return $this->hasOne(Customer::className(), [ 'id' => 'user_id' ]);
}
}