Article.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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 $CREATED_AT 创建时间
  13. */
  14. class Article extends \common\components\ActiveRecord
  15. {
  16. /**
  17. * @inheritdoc
  18. */
  19. public static function tableName()
  20. {
  21. return '{{%ARTICLE}}';
  22. }
  23. /**
  24. * @inheritdoc
  25. */
  26. public function rules()
  27. {
  28. return [
  29. [['CID', 'CREATED_AT'], 'required'],
  30. [['STATUS', 'CREATED_AT'], 'integer'],
  31. [['ID', 'CID'], 'string', 'max' => 32],
  32. [['TITLE'], 'string', 'max' => 255],
  33. [['CONTENT'], 'string', 'max' => 4000],
  34. [['TITLE'], 'unique'],
  35. [['ID'], 'unique'],
  36. ];
  37. }
  38. /**
  39. * @inheritdoc
  40. */
  41. public function attributeLabels()
  42. {
  43. return [
  44. 'ID' => 'ID',
  45. 'TITLE' => '标题',
  46. 'CID' => '分类ID',
  47. 'CONTENT' => '内容',
  48. 'STATUS' => '状态',
  49. 'CREATED_AT' => '创建时间',
  50. ];
  51. }
  52. }