29 lines
614 B
PHP
29 lines
614 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Models\Server;
|
||
|
|
|
||
|
|
use App\Models\Live\Anchor;
|
||
|
|
use Illuminate\Database\Eloquent\Model;
|
||
|
|
|
||
|
|
class MerchantShareChannel extends Model
|
||
|
|
{
|
||
|
|
public function bindMerchantAnchor()
|
||
|
|
{
|
||
|
|
return $this->hasOne(Anchor::class, 'm_id', 'bind_m_id');
|
||
|
|
}
|
||
|
|
|
||
|
|
public function bindMerchantUser(){
|
||
|
|
return $this->hasOne(MerchantUser::class, 'id', 'bind_m_user_id');
|
||
|
|
}
|
||
|
|
|
||
|
|
public function orders()
|
||
|
|
{
|
||
|
|
return $this->hasMany(TouristOrder::class, 'share_channel_id', 'id');
|
||
|
|
}
|
||
|
|
|
||
|
|
public function paidOrders()
|
||
|
|
{
|
||
|
|
return $this->orders()->where('pay_status', 1);
|
||
|
|
}
|
||
|
|
}
|