Blame view

backend/models/Order.php 3.83 KB
d8c1a2e0   Yarik   Big commit artbox
1
  <?php
36d1807a   Yarik   Big commit.
2
3
4
5
      
      namespace backend\models;
      
      use common\models\Customer;
c70f24ea   Yarik   For Leha commit.
6
      use common\models\User;
36d1807a   Yarik   Big commit.
7
      
c70f24ea   Yarik   For Leha commit.
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
      /**
       * Class Order
       *
       * @property int    $id
       * @property int    $user_id
       * @property string $name
       * @property string $phone
       * @property string $phone2
       * @property string $email
       * @property string $adress
       * @property string $body
       * @property double $total
       * @property string $date_time
       * @property string $date_dedline
       * @property string $reserve
       * @property string $status
       * @property string $comment
       * @property int    $label
       * @property int    $pay
       * @property int    $numbercard
       * @property int    $delivery
       * @property string $declaration
       * @property string $stock
       * @property string $consignment
       * @property string $payment
       * @property string $insurance
       * @property double $amount_imposed
       * @property string $shipping_by
       * @property string $city
       * @property User   $user
       * @package backend\models
       */
      class Order extends \yii\db\ActiveRecord
d8c1a2e0   Yarik   Big commit artbox
41
      {
d8c1a2e0   Yarik   Big commit artbox
42
          
36d1807a   Yarik   Big commit.
43
44
          public static function tableName()
          {
8af13427   Yarik   For leha commit.
45
              return 'order';
d8c1a2e0   Yarik   Big commit artbox
46
47
          }
          
36d1807a   Yarik   Big commit.
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
          public function rules()
          {
              return [
                  [
                      [ 'name' ],
                      'required',
                  ],
                  [
                      [
                          'user_id',
                          'adress',
                          'body',
                          'total',
                          'status',
                          'email',
                          'comment',
36d1807a   Yarik   Big commit.
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
94
95
96
97
98
                          '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'          => 'Сумма',
36d1807a   Yarik   Big commit.
99
100
101
102
103
104
105
106
107
108
109
110
111
112
                  'label'          => 'Метка',
                  'comment'        => 'Комментарий менеджера',
                  'date_dedline'   => 'Дедлайн',
                  'numbercard'     => '№ карточки',
                  'delivery'       => 'Доставка',
                  'declaration'    => 'Декларация №',
                  'stock'          => '№ склада',
                  'consignment'    => '№ накладной',
                  'payment'        => 'Способ оплаты',
                  'insurance'      => 'Страховка',
                  'amount_imposed' => 'Сумма наложенного',
                  'shipping_by'    => 'Отправка за счет',
                  'city'           => 'Город',
              ];
d8c1a2e0   Yarik   Big commit artbox
113
114
          }
          
36d1807a   Yarik   Big commit.
115
116
117
118
          public function getUser()
          {
              return $this->hasOne(Customer::className(), [ 'id' => 'user_id' ]);
          }
d8c1a2e0   Yarik   Big commit artbox
119
          
36d1807a   Yarik   Big commit.
120
      }