Commit e5de9e74b1fc95feac7c2a1aff46deac8497e3cb

Authored by Anastasia
1 parent 94b9b80c

order ip

migrations/m170620_093957_order_add_ip.php 0 → 100644
  1 +<?php
  2 +
  3 + use yii\db\Migration;
  4 +
  5 + class m170620_093957_order_add_ip extends Migration
  6 + {
  7 + public function safeUp()
  8 + {
  9 + $this->addColumn('order', 'ip', $this->string());
  10 + }
  11 +
  12 + public function safeDown()
  13 + {
  14 + $this->dropColumn('order', 'ip');
  15 + }
  16 +
  17 + /*
  18 + // Use up()/down() to run migration code without a transaction.
  19 + public function up()
  20 + {
  21 +
  22 + }
  23 +
  24 + public function down()
  25 + {
  26 + echo "m170620_093957_order_add_ip cannot be reverted.\n";
  27 +
  28 + return false;
  29 + }
  30 + */
  31 + }
... ...
models/Order.php
... ... @@ -82,6 +82,7 @@
82 82 'address',
83 83 'comment',
84 84 'secondname',
  85 + 'ip',
85 86 ],
86 87 'string',
87 88 'max' => 255,
... ...
views/order/index.php
... ... @@ -36,6 +36,7 @@
36 36 'secondname',
37 37 'phone',
38 38 'email:email',
  39 + 'ip',
39 40 [
40 41 'attribute' => 'label_id',
41 42 'value' => 'label.lang.title',
... ... @@ -51,7 +52,7 @@
51 52 return count($model->orderProducts);
52 53 },
53 54 ],
54   -
  55 +
55 56 [ 'class' => 'yii\grid\ActionColumn' ],
56 57 ],
57 58 ]
... ...
views/order/view.php
... ... @@ -59,6 +59,7 @@
59 59 'city',
60 60 'address',
61 61 'comment',
  62 + 'ip',
62 63 'created_at:datetime',
63 64 'updated_at:datetime',
64 65 'deleted_at:datetime',
... ...