Commit e271f35768a0d7bd2c3b2e4eced3d3b4dc795aa5
1 parent
dbc5f7f0
delete wish from account
Showing
3 changed files
with
46 additions
and
0 deletions
Show diff stats
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +use yii\db\Migration; | ||
| 4 | + | ||
| 5 | +class m170714_090429_add_default_columns extends Migration | ||
| 6 | +{ | ||
| 7 | + public function safeUp() | ||
| 8 | + { | ||
| 9 | + $this->addColumn('label', 'default', $this->boolean()->defaultValue(false)); | ||
| 10 | + $this->addColumn('delivery', 'default', $this->boolean()->defaultValue(false)); | ||
| 11 | + $this->addColumn('payment', 'default', $this->boolean()->defaultValue(false)); | ||
| 12 | + } | ||
| 13 | + | ||
| 14 | + public function safeDown() | ||
| 15 | + { | ||
| 16 | + echo "m170714_090429_add_default_columns cannot be reverted.\n"; | ||
| 17 | + | ||
| 18 | + return false; | ||
| 19 | + } | ||
| 20 | + | ||
| 21 | + /* | ||
| 22 | + // Use up()/down() to run migration code without a transaction. | ||
| 23 | + public function up() | ||
| 24 | + { | ||
| 25 | + | ||
| 26 | + } | ||
| 27 | + | ||
| 28 | + public function down() | ||
| 29 | + { | ||
| 30 | + echo "m170714_090429_add_default_columns cannot be reverted.\n"; | ||
| 31 | + | ||
| 32 | + return false; | ||
| 33 | + } | ||
| 34 | + */ | ||
| 35 | +} |
models/Label.php
| @@ -88,6 +88,10 @@ | @@ -88,6 +88,10 @@ | ||
| 88 | [ 'status' ], | 88 | [ 'status' ], |
| 89 | 'boolean', | 89 | 'boolean', |
| 90 | ], | 90 | ], |
| 91 | + [ | ||
| 92 | + [ 'default' ], | ||
| 93 | + 'boolean', | ||
| 94 | + ], | ||
| 91 | ]; | 95 | ]; |
| 92 | } | 96 | } |
| 93 | 97 | ||
| @@ -102,6 +106,7 @@ | @@ -102,6 +106,7 @@ | ||
| 102 | 'value' => Yii::t('order', 'Value'), | 106 | 'value' => Yii::t('order', 'Value'), |
| 103 | 'status' => Yii::t('order', 'Status'), | 107 | 'status' => Yii::t('order', 'Status'), |
| 104 | 'color' => Yii::t('order', 'Color'), | 108 | 'color' => Yii::t('order', 'Color'), |
| 109 | + 'default'=> Yii::t('order', 'Default'), | ||
| 105 | ]; | 110 | ]; |
| 106 | } | 111 | } |
| 107 | 112 |
views/label/_form.php
| @@ -37,6 +37,12 @@ | @@ -37,6 +37,12 @@ | ||
| 37 | 'class' => 'flat', | 37 | 'class' => 'flat', |
| 38 | ] | 38 | ] |
| 39 | ) ?> | 39 | ) ?> |
| 40 | + <?= $form->field($model, 'default') | ||
| 41 | + ->checkbox( | ||
| 42 | + [ | ||
| 43 | + 'class' => 'flat', | ||
| 44 | + ] | ||
| 45 | + ) ?> | ||
| 40 | 46 | ||
| 41 | <?php | 47 | <?php |
| 42 | echo $form->field($model, 'color') | 48 | echo $form->field($model, 'color') |