Article.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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 $COUNTRY_ID 国家ID
  9. * @property string $TITLE 标题
  10. * @property string $CID 分类ID
  11. * @property string $CONTENT 内容
  12. * @property int $STATUS 状态
  13. * @property int $SORT 排序值
  14. * @property int $CREATED_AT 创建时间
  15. */
  16. class Article extends \common\components\ActiveRecord
  17. {
  18. /**
  19. * @inheritdoc
  20. */
  21. public static function tableName()
  22. {
  23. return '{{%ARTICLE}}';
  24. }
  25. /**
  26. * @inheritdoc
  27. */
  28. public function rules()
  29. {
  30. return [
  31. [['CID', 'CREATED_AT', 'COUNTRY_ID'], 'required'],
  32. [['COUNTRY_ID'], 'string'],
  33. [['STATUS', 'CREATED_AT', 'SORT'], 'integer'],
  34. [['ID', 'CID'], 'string', 'max' => 32],
  35. [['TITLE'], 'string', 'max' => 255],
  36. [['CONTENT'], 'string', 'max' => 4000],
  37. [['TITLE'], 'unique'],
  38. [['ID'], 'unique'],
  39. ];
  40. }
  41. /**
  42. * @inheritdoc
  43. */
  44. public function attributeLabels()
  45. {
  46. return [
  47. 'ID' => 'ID',
  48. 'TITLE' => Yii::t('app', 'title'),
  49. 'COUNTRY_ID' => Yii::t('app', 'country'),
  50. 'CID' => Yii::t('app', 'category'),
  51. 'CONTENT' => Yii::t('app', 'content'),
  52. 'STATUS' => Yii::t('app', 'state'),
  53. 'Order' => Yii::t('app', 'sort'),
  54. 'CREATED_AT' => Yii::t('app', 'createAt'),
  55. ];
  56. }
  57. }