You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 lines
1.5 KiB

  1. <?php
  2. namespace common\models\ars;
  3. use Yii;
  4. use yii\behaviors\TimestampBehavior;
  5. /**
  6. * This is the model class for table "ats_brand".
  7. *
  8. * @property int $id
  9. * @property string $name 品牌名
  10. * @property int $is_delete 是否删除,1为已删除
  11. * @property int $created_at 创建时间
  12. * @property int $updated_at 更新时间
  13. */
  14. class Brand extends \yii\db\ActiveRecord
  15. {
  16. /**
  17. * {@inheritdoc}
  18. */
  19. public static function tableName()
  20. {
  21. return 'ats_brand';
  22. }
  23. /**
  24. * {@inheritdoc}
  25. */
  26. public function rules()
  27. {
  28. return [
  29. [['is_delete'], 'integer'],
  30. [['name'], 'string', 'max' => 50],
  31. ];
  32. }
  33. /**
  34. * {@inheritdoc}
  35. */
  36. public function attributeLabels()
  37. {
  38. return [
  39. 'id' => 'id',
  40. 'name' => '品牌名',
  41. 'is_delete' => '是否删除,1为已删除',
  42. 'created_at' => '创建时间',
  43. 'updated_at' => '更新时间',
  44. ];
  45. }
  46. /**
  47. * @author linyao
  48. * @email 602604991@qq.com
  49. * @created Nov 8, 2019
  50. *
  51. * 行为存储创建时间和更新时间
  52. */
  53. public function behaviors()
  54. {
  55. return [
  56. [
  57. 'class' => TimestampBehavior::className(),
  58. 'createdAtAttribute' => 'created_at',
  59. 'updatedAtAttribute' => 'updated_at',
  60. 'value' => function() {
  61. return time();
  62. },
  63. ],
  64. ];
  65. }
  66. }