GoodsCategoryModel.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
  4. // +----------------------------------------------------------------------
  5. // | 版权所有 2017~2021 LARAVEL研发中心
  6. // +----------------------------------------------------------------------
  7. // | 官方网站: http://www.laravel.cn
  8. // +----------------------------------------------------------------------
  9. // | Author: laravel开发员 <laravel.qq.com>
  10. // +----------------------------------------------------------------------
  11. namespace App\Models;
  12. /**
  13. * 商品分类管理-模型
  14. * @author laravel开发员
  15. * @since 2020/11/11
  16. * @package App\Models
  17. */
  18. class GoodsCategoryModel extends BaseModel
  19. {
  20. // 设置数据表
  21. protected $table = 'goods_categorys';
  22. protected $appends = ['type_name'];
  23. // 封面图
  24. public function getIconAttribute($value)
  25. {
  26. $thumb = $value ? get_image_url($value) : '';
  27. return $thumb;
  28. }
  29. public function setIconAttribute($value)
  30. {
  31. return $value ? get_image_path($value) : '';
  32. }
  33. public function getTypeNameAttribute()
  34. {
  35. $types = ['',1=>'自营品专区',2=>'延时专区',3=>'深度体验',4=>'男神玩具',5=>'女神玩具',6=>'私密养护',7=>'情趣服饰(香水)',8=>'SM房趣(套装)',9=>'体感娃娃',10=>'周边产品'];
  36. return isset($types[$this->type]) ? $types[$this->type] : '';
  37. }
  38. }