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

44 lines
835 B

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 agentInfo()
  9. {
  10. return $this->hasOne(AgentInfo::class);
  11. }
  12. //密码修改
  13. public function setPasswordAttribute($value)
  14. {
  15. if (!empty($value)) {
  16. $this->attributes['password'] = password_hash($value, PASSWORD_BCRYPT);
  17. }
  18. }
  19. public function agentProduct()
  20. {
  21. return $this->hasMany(AgentProduct::class);
  22. }
  23. public function demand()
  24. {
  25. return $this->morphOne('App\Models\Demand', 'publisher');
  26. }
  27. public function demandUser()
  28. {
  29. return $this->morphOne('App\Models\Demand', 'biddingUser');
  30. }
  31. public function demandBidding()
  32. {
  33. return $this->morphOne('App\Models\DemandBidding', 'biddingUser');
  34. }
  35. }