123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167 |
- <?php
- namespace App\Models;
- use App\Enums\TechnicianStatus;
- use App\Traits\HasStateText;
- use Illuminate\Database\Eloquent\SoftDeletes;
- use Slowlyo\OwlAdmin\Models\BaseModel as Model;
- /**
- * 技师用户模型
- */
- class CoachUser extends Model
- {
- use HasStateText, SoftDeletes;
- protected $table = 'coach_users';
- protected $guarded = [];
- /**
- * 状态枚举类
- */
- protected string $stateEnumClass = TechnicianStatus::class;
- /**
- * @Author FelixYin
- * @description 技师关联信息
- */
- public function info()
- {
- return $this->hasOne('App\Models\CoachInfoRecord', 'id', 'info_record_id');
- }
- /**
- * 获取技师关联的用户
- */
- public function user()
- {
- return $this->belongsTo(MemberUser::class, 'user_id');
- }
- /**
- * 获取技师的统计数据
- */
- public function statistic()
- {
- return $this->hasOne(CoachStatistic::class, 'coach_id');
- }
- /**
- * @Author FelixYin
- * @description 技师所属会员
- */
- public function member()
- {
- return $this->belongsTo('App\Models\MemberUser', 'user_id');
- }
- /**
- * @Author FelixYin
- * @description 基本信息认证记录
- */
- public function infoRecords()
- {
- return $this->hasMany('App\Models\CoachInfoRecord', 'coach_id', 'id');
- }
- /**
- * @Author FelixYin
- * @description 技师关联资质信息
- */
- public function qual()
- {
- return $this->hasOne('App\Models\CoachQualRecord', 'id', 'qualification_record_id');
- }
- /**
- * @Author FelixYin
- * @description 技师关联评分
- */
- public function score()
- {
- return $this->hasOne('App\Models\CoachScore', 'coach_id', 'id');
- }
- /**
- * @Author FelixYin
- * @description 技师关联定位
- */
- public function locations()
- {
- return $this->hasMany('App\Models\CoachLocation', 'coach_id', 'id');
- }
- /**
- * @Author FelixYin
- * @description 技师关联订单
- */
- public function orders()
- {
- return $this->hasMany('App\Models\Order', 'coach_id', 'id');
- }
- /**
- * @Author FelixYin
- * @description 技师关联抢单记录
- */
- public function grabRecords()
- {
- return $this->hasMany('App\Models\OrderGrabRecord', 'coach_id', 'id');
- }
- /**
- * @Author FelixYin
- * @description 技师关联评论
- */
- public function comments()
- {
- return $this->hasMany('App\Models\OrderComment', 'coach_id', 'id');
- }
- /**
- * @Author FelixYin
- * @description 技师关联钱包
- */
- public function wallet()
- {
- return $this->MORPH_ONE('App\Models\Wallet', 'undefined');
- }
- /**
- * @Author FelixYin
- * @description 技师所属店铺
- */
- public function shop()
- {
- return $this->belongsTo('App\Models\ShopInfo', 'shop_id', 'shop_id');
- }
- /**
- * @Author FelixYin
- * @description 技师关联店铺开通服务
- */
- public function shopOpenService()
- {
- return $this->hasMany('App\Models\ShopCoachService', 'coach_id', 'id');
- }
- /**
- * @Author FelixYin
- * @description 技师关联实名信息
- */
- public function real()
- {
- return $this->hasOne('App\Models\CoachRealAuthRecord', 'id', 'real_auth_record_id');
- }
- /**
- * @Author FelixYin
- * @description 技师开通项目
- */
- public function projects()
- {
- return $this->hasMany('App\Models\CoachProject', 'coach_id', 'id');
- }
- }
|