Recommend.php 555 B

1234567891011121314151617181920212223242526
  1. <?php
  2. namespace app\model;
  3. use think\Model;
  4. class Recommend extends Model
  5. {
  6. public function community()
  7. {
  8. return $this->belongsTo(Community::class, 'community')->bind(['community_name'=>'name']);
  9. }
  10. public function style()
  11. {
  12. return $this->belongsTo(Decostyle::class, 'style')->bind(['style_name'=>'name']);
  13. }
  14. public function getCoverImgAttr($value)
  15. {
  16. if(empty($value)) return $value;
  17. $bindUrl = config('app.ali_oss_bindurl');
  18. return 'http://' . $bindUrl . '/' . $value;
  19. }
  20. }