ShopInfo.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Database\Eloquent\SoftDeletes;
  4. use Slowlyo\OwlAdmin\Models\BaseModel as Model;
  5. /**
  6. * 店铺
  7. */
  8. class ShopInfo extends Model
  9. {
  10. use SoftDeletes;
  11. protected $table = 'shop_infos';
  12. /**
  13. * @Author FelixYin
  14. * @description 店铺所属会员
  15. */
  16. public function member()
  17. {
  18. return $this->belongsTo(MemberUser::class, 'user_id', 'id');
  19. }
  20. /**
  21. * @Author FelixYin
  22. * @description 店铺关联认证信息
  23. */
  24. public function auth()
  25. {
  26. return $this->hasOne(ShopAuthRecord::class, 'id', 'auth_record_id');
  27. }
  28. /**
  29. * @Author FelixYin
  30. * @description 店铺关联技师
  31. */
  32. public function coaches()
  33. {
  34. return $this->hasMany(CoachUser::class, 'shop_id', 'id');
  35. }
  36. /**
  37. * @Author FelixYin
  38. * @description 店铺关联服务
  39. */
  40. public function services()
  41. {
  42. return $this->hasMany(ShopService::class, 'shop_id', 'id');
  43. }
  44. /**
  45. * @Author FelixYin
  46. * @description 店铺关联认证记录
  47. */
  48. public function authRecords()
  49. {
  50. return $this->hasMany(ShopAuthRecord::class, 'shop_id', 'id');
  51. }
  52. /**
  53. * 获取店铺认证记录
  54. */
  55. public function authRecord()
  56. {
  57. return $this->belongsTo(ShopAuthRecord::class, 'auth_record_id');
  58. }
  59. }