Advertisement
pmtpenza22

Untitled

Feb 18th, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.67 KB | None | 0 0
  1. <?php
  2.  
  3. namespace backend\models;
  4. use kartik\tree\models\Tree;
  5.  
  6. use Yii;
  7.  
  8. /**
  9. * This is the model class for table "category".
  10. *
  11. * @property int $id
  12. * @property int $root
  13. * @property int $lft
  14. * @property int $rgt
  15. * @property int $lvl
  16. * @property string $name
  17. * @property string $icon
  18. * @property int $icon_type
  19. * @property int $active
  20. * @property int $selected
  21. * @property int $disabled
  22. * @property int $readonly
  23. * @property int $visible
  24. * @property int $collapsed
  25. * @property int $movable_u
  26. * @property int $movable_d
  27. * @property int $movable_l
  28. * @property int $movable_r
  29. * @property int $removable
  30. * @property int $removable_all
  31. * @property int $child_allowed
  32. */
  33. class Cat extends \kartik\tree\models\Tree
  34. {
  35. /**
  36. * {@inheritdoc}
  37. */
  38. public static function tableName()
  39. {
  40. return 'category';
  41. }
  42.  
  43. /**
  44. * {@inheritdoc}
  45. */
  46. public function rules()
  47. {
  48. return [
  49. [['root', 'lft', 'rgt', 'lvl', 'icon_type', 'active', 'selected', 'disabled', 'readonly', 'visible', 'collapsed', 'movable_u', 'movable_d', 'movable_l', 'movable_r', 'removable', 'removable_all', 'child_allowed'], 'integer'],
  50. [['name'], 'required'],
  51. [['name'], 'string', 'max' => 60],
  52. [['icon'], 'string', 'max' => 255],
  53. [['lft', 'rgt', 'lvl'],'safe'],
  54. ];
  55. }
  56.  
  57. /**
  58. * {@inheritdoc}
  59. */
  60. public function attributeLabels()
  61. {
  62. return [
  63. 'id' => 'ID',
  64. 'root' => 'Root',
  65. 'lft' => 'Lft',
  66. 'rgt' => 'Rgt',
  67. 'lvl' => 'Lvl',
  68. 'name' => 'Name',
  69. 'icon' => 'Icon',
  70. 'icon_type' => 'Icon Type',
  71. 'active' => 'Active',
  72. 'selected' => 'Selected',
  73. 'disabled' => 'Disabled',
  74. 'readonly' => 'Readonly',
  75. 'visible' => 'Visible',
  76. 'collapsed' => 'Collapsed',
  77. 'movable_u' => 'Movable U',
  78. 'movable_d' => 'Movable D',
  79. 'movable_l' => 'Movable L',
  80. 'movable_r' => 'Movable R',
  81. 'removable' => 'Removable',
  82. 'removable_all' => 'Removable All',
  83. 'child_allowed' => 'Child Allowed',
  84. ];
  85. }
  86. /* public function rules()
  87. {
  88. $rules = parent::rules();
  89. $rules[] = ['content_type', 'integer','min'=>0];
  90. $rules[] = ['content_type', 'default','value'=>0];
  91. return $rules;
  92. }*/
  93. /*public function isDisabled()
  94. {
  95. if (Yii::$app->user->username !== 'admin') {
  96. return true;
  97. }
  98. return parent::isDisabled();
  99. }*/
  100. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement