Article.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. namespace common\models;
  3. use Yii;
  4. /**
  5. * This is the model class for table "{{%ARTICLE}}".
  6. *
  7. * @property string $ID
  8. * @property string $TITLE 标题
  9. * @property string $CID 分类ID
  10. * @property string $CONTENT 内容
  11. * @property int $STATUS 状态
  12. * @property int $SORT 排序值
  13. * @property int $CREATED_AT 创建时间
  14. */
  15. class Article extends \common\components\ActiveRecord
  16. {
  17. /**
  18. * @inheritdoc
  19. */
  20. public static function tableName()
  21. {
  22. return '{{%ARTICLE}}';
  23. }
  24. /**
  25. * @inheritdoc
  26. */
  27. public function rules()
  28. {
  29. return [
  30. [['CID', 'CREATED_AT'], 'required'],
  31. [['STATUS', 'CREATED_AT', 'SORT'], 'integer'],
  32. [['ID', 'CID'], 'string', 'max' => 32],
  33. [['TITLE'], 'string', 'max' => 255],
  34. [['CONTENT'], 'string', 'max' => 4000],
  35. [['TITLE'], 'unique'],
  36. [['ID'], 'unique'],
  37. ];
  38. }
  39. /**
  40. * @inheritdoc
  41. */
  42. public function attributeLabels()
  43. {
  44. return [
  45. 'ID' => 'ID',
  46. 'TITLE' => Yii::t('app', 'title'),
  47. 'CID' => Yii::t('app', 'category'),
  48. 'CONTENT' => Yii::t('app', 'content'),
  49. 'STATUS' => Yii::t('app', 'state'),
  50. 'Order' => Yii::t('app', 'sort'),
  51. 'CREATED_AT' => Yii::t('app', 'createAt'),
  52. ];
  53. }
  54. }