Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace backend\models;
- use kartik\tree\models\Tree;
- use Yii;
- /**
- * This is the model class for table "category".
- *
- * @property int $id
- * @property int $root
- * @property int $lft
- * @property int $rgt
- * @property int $lvl
- * @property string $name
- * @property string $icon
- * @property int $icon_type
- * @property int $active
- * @property int $selected
- * @property int $disabled
- * @property int $readonly
- * @property int $visible
- * @property int $collapsed
- * @property int $movable_u
- * @property int $movable_d
- * @property int $movable_l
- * @property int $movable_r
- * @property int $removable
- * @property int $removable_all
- * @property int $child_allowed
- */
- class Cat extends \kartik\tree\models\Tree
- {
- /**
- * {@inheritdoc}
- */
- public static function tableName()
- {
- return 'category';
- }
- /**
- * {@inheritdoc}
- */
- public function rules()
- {
- return [
- [['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'],
- [['name'], 'required'],
- [['name'], 'string', 'max' => 60],
- [['icon'], 'string', 'max' => 255],
- [['lft', 'rgt', 'lvl'],'safe'],
- ];
- }
- /**
- * {@inheritdoc}
- */
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'root' => 'Root',
- 'lft' => 'Lft',
- 'rgt' => 'Rgt',
- 'lvl' => 'Lvl',
- 'name' => 'Name',
- 'icon' => 'Icon',
- 'icon_type' => 'Icon Type',
- 'active' => 'Active',
- 'selected' => 'Selected',
- 'disabled' => 'Disabled',
- 'readonly' => 'Readonly',
- 'visible' => 'Visible',
- 'collapsed' => 'Collapsed',
- 'movable_u' => 'Movable U',
- 'movable_d' => 'Movable D',
- 'movable_l' => 'Movable L',
- 'movable_r' => 'Movable R',
- 'removable' => 'Removable',
- 'removable_all' => 'Removable All',
- 'child_allowed' => 'Child Allowed',
- ];
- }
- /* public function rules()
- {
- $rules = parent::rules();
- $rules[] = ['content_type', 'integer','min'=>0];
- $rules[] = ['content_type', 'default','value'=>0];
- return $rules;
- }*/
- /*public function isDisabled()
- {
- if (Yii::$app->user->username !== 'admin') {
- return true;
- }
- return parent::isDisabled();
- }*/
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement