1
0

Designer.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. namespace app\model;
  3. use think\Model;
  4. class Designer extends Model
  5. {
  6. public function case()
  7. {
  8. return $this->hasMany(MaterialCase::class, 'designer_id','id');
  9. }
  10. public function getVcrAttr($value)
  11. {
  12. if (empty($value)) return $value;
  13. $domain = config('app.ali_oss_bindurl');
  14. $item = 'https://' . $domain . '/' . $value;
  15. return $item;
  16. }
  17. public function getHeadimgurlAttr($value)
  18. {
  19. if (empty($value)) return $value;
  20. $domain = config('app.ali_oss_bindurl');
  21. $item = 'https://' . $domain . '/' . $value;
  22. return $item;
  23. }
  24. public function getGoodAtAttr($value)
  25. {
  26. if (empty($value)) return [];
  27. $res = explode(',',$value);
  28. return $res;
  29. }
  30. public function getGoodHouseAttr($value)
  31. {
  32. if (empty($value)) return [];
  33. $res = explode(',',$value);
  34. return $res;
  35. }
  36. public function employee()
  37. {
  38. return $this->belongsTo(Employee::class)->bind(['employee_name'=>'name']);
  39. }
  40. }