Notice.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: Administrator
  5. * Date: 2017/11/1/001
  6. * Time: 16:50
  7. */
  8. namespace backend\models;
  9. use Yii;
  10. use yii\db\ActiveRecord;
  11. /**
  12. * Class Notice
  13. * @package backend\models
  14. * @property integer $id
  15. * @property integer $type
  16. * @property string $title
  17. * @property string $content
  18. * @property integer $in_time
  19. */
  20. class Notice extends ActiveRecord
  21. {
  22. public static function tableName()
  23. {
  24. return 'crm_notice';
  25. }
  26. /**
  27. * @return \yii\db\Connection the database connection used by this AR class.
  28. */
  29. public static function getDb()
  30. {
  31. return Yii::$app->get('dbXcrm');
  32. }
  33. public function rules()
  34. {
  35. return [
  36. [['id', 'type', 'in_time'], 'integer'],
  37. [['title', 'content'], 'required'],
  38. [['content'], 'string'],
  39. [['title'], 'string', 'max' => '255'],
  40. ];
  41. }
  42. public function attributeLabels()
  43. {
  44. return [
  45. 'id' => 'ID',
  46. 'type' => '类型',
  47. 'title' => '标题',
  48. 'content' => '内容',
  49. 'in_time' => '发布时间',
  50. ];
  51. }
  52. }