65 lines
1.8 KiB
PHP
65 lines
1.8 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Models;
|
||
|
|
|
||
|
|
use App\Models\Live\Viewer;
|
||
|
|
use App\Models\Server\CommunityActivityMember;
|
||
|
|
use App\Models\Server\MerchantUser;
|
||
|
|
use App\Models\Server\MRefundOrder;
|
||
|
|
use App\Models\Server\QrCode;
|
||
|
|
use App\Models\Server\UserEvaluate;
|
||
|
|
use Illuminate\Database\Eloquent\Model;
|
||
|
|
use App\Models\User;
|
||
|
|
class TouristOrder extends Model
|
||
|
|
{
|
||
|
|
protected $fillable = [];
|
||
|
|
protected $guarded = [];
|
||
|
|
public function viewer(){
|
||
|
|
return $this->hasOne(Viewer::class,'openid','open_id');
|
||
|
|
}
|
||
|
|
public function fromUser(){
|
||
|
|
return $this->hasOne(Viewer::class,'openid','from_openid');
|
||
|
|
}
|
||
|
|
public function recive(){
|
||
|
|
return $this->hasOne(ShopRecive::class,'order_id','id');
|
||
|
|
}
|
||
|
|
public function operator(){
|
||
|
|
return $this->hasOne(User::class,'id','operator')->select('id','nickname','name','app_avatar','circle_avatar','mobile');
|
||
|
|
}
|
||
|
|
public function user(){
|
||
|
|
return $this->hasOne(MerchantUser::class,'id','account_id');
|
||
|
|
}
|
||
|
|
|
||
|
|
public function user_evaluate(){
|
||
|
|
return $this->hasOne(UserEvaluate::class, 'order_id', 'trade_no');
|
||
|
|
}
|
||
|
|
public function qrcode()
|
||
|
|
{
|
||
|
|
return $this->hasOne(QrCode::class, 'type_id', 'type_id');
|
||
|
|
}
|
||
|
|
|
||
|
|
public function userCoupon()
|
||
|
|
{
|
||
|
|
return $this->hasOne(UserCoupon::class, 'id', 'user_coupon_id');
|
||
|
|
}
|
||
|
|
|
||
|
|
// public function good(){
|
||
|
|
// return $this->hasOne(CommunityActivityResource::class,'')
|
||
|
|
// }
|
||
|
|
|
||
|
|
public function virtualMembers()
|
||
|
|
{
|
||
|
|
return $this->hasMany(CommunityActivityMember::class, 'order_id', 'id');
|
||
|
|
}
|
||
|
|
|
||
|
|
public function earnings()
|
||
|
|
{
|
||
|
|
return $this->hasMany(MEarning::class, 'm_order_id', 'id');
|
||
|
|
}
|
||
|
|
|
||
|
|
public function refunds()
|
||
|
|
{
|
||
|
|
return $this->hasMany(MRefundOrder::class, 'trade_no', 'trade_no');
|
||
|
|
}
|
||
|
|
}
|