Blame view

backend/models/Orders.php 2.98 KB
d8c1a2e0   Yarik   Big commit artbox
1
  <?php
36d1807a   Yarik   Big commit.
2
3
4
5
6
7
      
      namespace backend\models;
      
      use common\models\Customer;
      
      class Orders extends \yii\db\ActiveRecord
d8c1a2e0   Yarik   Big commit artbox
8
      {
d8c1a2e0   Yarik   Big commit artbox
9
          
36d1807a   Yarik   Big commit.
10
          public $labels;
d8c1a2e0   Yarik   Big commit artbox
11
          
36d1807a   Yarik   Big commit.
12
13
14
          public static function tableName()
          {
              return 'orders';
d8c1a2e0   Yarik   Big commit artbox
15
16
          }
          
36d1807a   Yarik   Big commit.
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
          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'             => '№ заказа',
                  'name'           => 'ФИО',
                  'phone'          => 'Телефон',
                  'phone2'         => 'Телефон 2',
                  'adress'         => 'Адрес',
                  'body'           => 'Сообщение',
                  'reserve'        => 'Резерв',
                  'status'         => 'Статус',
                  'email'          => 'E-mail',
                  'total'          => 'Сумма',
                  'labels'         => 'Метки',
                  'label'          => 'Метка',
                  'comment'        => 'Комментарий менеджера',
                  'date_dedline'   => 'Дедлайн',
                  'numbercard'     => '№ карточки',
                  'delivery'       => 'Доставка',
                  'declaration'    => 'Декларация №',
                  'stock'          => '№ склада',
                  'consignment'    => '№ накладной',
                  'payment'        => 'Способ оплаты',
                  'insurance'      => 'Страховка',
                  'amount_imposed' => 'Сумма наложенного',
                  'shipping_by'    => 'Отправка за счет',
                  'city'           => 'Город',
              ];
d8c1a2e0   Yarik   Big commit artbox
84
85
          }
          
36d1807a   Yarik   Big commit.
86
87
88
89
          public function getUser()
          {
              return $this->hasOne(Customer::className(), [ 'id' => 'user_id' ]);
          }
d8c1a2e0   Yarik   Big commit artbox
90
          
36d1807a   Yarik   Big commit.
91
      }