海南旅游SAAS
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.

38 lines
838 B

4 years ago
4 years ago
4 years ago
4 years ago
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Database\Eloquent\Factories\HasFactory;
  4. use Illuminate\Database\Eloquent\SoftDeletes;
  5. class Agent extends BaseModel
  6. {
  7. use HasFactory, SoftDeletes;
  8. public function getLogoAttribute($value): string
  9. {
  10. return $value ? $this->host . $value : '';
  11. }
  12. public function getLicensePicAttribute($value): string
  13. {
  14. return $value ? $this->host . $value : '';
  15. }
  16. public function setLogoAttribute($value)
  17. {
  18. //修改器里面$this->host变量为空
  19. $this->attributes['logo'] = str_replace(env('APP_URL'), '', $value);
  20. }
  21. public function setLicensePicAttribute($value)
  22. {
  23. //修改器里面$this->host变量为空
  24. $this->attributes['license_pic'] = str_replace(env('APP_URL'), '', $value);
  25. }
  26. public function agentInfo()
  27. {
  28. return $this->hasOne(AgentInfo::class);
  29. }
  30. }