MaterType.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. namespace common\models;
  3. use Yii;
  4. /**
  5. * This is the model class for table "{{%mater_type}}".
  6. *
  7. * @property integer $id
  8. * @property string $name
  9. * @property integer $sort
  10. * @property integer $status
  11. * @property integer $c_time
  12. * @property integer $u_time
  13. */
  14. class MaterType extends \yii\db\ActiveRecord
  15. {
  16. /**
  17. * @inheritdoc
  18. */
  19. const STATUS_YES = 10;
  20. const STATUS_NO = 0;
  21. public static function tableName()
  22. {
  23. return '{{%mater_type}}';
  24. }
  25. /**
  26. * @inheritdoc
  27. */
  28. public function rules()
  29. {
  30. return [
  31. [['c_time', 'u_time'], 'default','value'=>time()],
  32. [['status'], 'default','value'=>self::STATUS_YES],
  33. [['name','c_time'], 'required'],
  34. [['name'], 'string','max' => 32],
  35. [['sort','c_time', 'u_time','status'], 'integer'],
  36. ];
  37. }
  38. /**
  39. * @inheritdoc
  40. */
  41. public function attributeLabels()
  42. {
  43. return [
  44. 'id' => 'ID',
  45. 'name' => '分类名称',
  46. 'sort' => '序号',
  47. 'status' => '状态',
  48. 'c_time' => '创建时间',
  49. 'u_time' => '更新时间',
  50. ];
  51. }
  52. }