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

51 lines
974 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 Guide extends BaseModel
  6. {
  7. use HasFactory, SoftDeletes;
  8. //密码修改
  9. public function setPasswordAttribute($value)
  10. {
  11. if (!empty($value)) {
  12. $this->attributes['password'] = password_hash($value, PASSWORD_BCRYPT);
  13. }
  14. }
  15. public function demand()
  16. {
  17. return $this->morphOne('App\Models\Demand', 'publisher');
  18. }
  19. public function demandUser()
  20. {
  21. return $this->morphOne('App\Models\Demand', 'biddingUser');
  22. }
  23. public function demandBidding()
  24. {
  25. return $this->morphOne('App\Models\DemandBidding', 'biddingUser');
  26. }
  27. public function workoorder()
  28. {
  29. return $this->morphOne('App\Models\Workorder', 'publisher');
  30. }
  31. public function workoorderitem()
  32. {
  33. return $this->morphOne('App\Models\WorkorderItem', 'publisher');
  34. }
  35. public function statement()
  36. {
  37. return $this->morphMany('App\Models\Statement', 'user');
  38. }
  39. }