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

56 lines
1.1 KiB

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 Supplier extends BaseModel
  6. {
  7. use HasFactory, SoftDeletes;
  8. protected $casts = ['publish_type' => 'json'];
  9. //密码修改
  10. public function setPasswordAttribute($value)
  11. {
  12. if (!empty($value)) {
  13. $this->attributes['password'] = password_hash($value, PASSWORD_BCRYPT);
  14. }
  15. }
  16. public function demand()
  17. {
  18. return $this->morphOne('App\Models\Demand', 'publisher');
  19. }
  20. public function demandUser()
  21. {
  22. return $this->morphOne('App\Models\Demand', 'biddingUser');
  23. }
  24. public function demandBidding()
  25. {
  26. return $this->morphOne('App\Models\DemandBidding', 'biddingUser');
  27. }
  28. public function agentProductItem()
  29. {
  30. return $this->hasMany(AgentProductItem::class);
  31. }
  32. public function workoorder()
  33. {
  34. return $this->morphOne('App\Models\Workorder', 'publisher');
  35. }
  36. public function point()
  37. {
  38. return $this->morphOne('App\Models\Workorder', 'point');
  39. }
  40. public function workoorderitem()
  41. {
  42. return $this->morphOne('App\Models\WorkorderItem', 'publisher');
  43. }
  44. }