MallCate.php 579 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. namespace app\common\model;
  3. use think\Model;
  4. class MallCate extends Model
  5. {
  6. // 设置字段信息
  7. protected $schema = [
  8. 'id' => 'int',
  9. 'title' => 'string',
  10. 'status' => 'tinyint',
  11. 'priority' => 'int'
  12. ];
  13. public function getStatusTextAttr($value,$data)
  14. {
  15. $status = [1=>'显示', 2=>'隐藏'];
  16. return $status[$data['status']];
  17. }
  18. public function getIntegralTextAttr($value,$data)
  19. {
  20. return 0;
  21. }
  22. // 关联MallGoods
  23. public function mallGoods()
  24. {
  25. return $this->hasMany(MallGoods::class, "cateid", "id");
  26. }
  27. }