ShareRelationship.php
1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
/**
* Created by PhpStorm.
* User: machengjun
* Date: 2018/2/3
* Time: 下午8:38
*/
namespace App\Modules\Models\Share\Traits\Relationship;
use App\Modules\Models\Customer\Customer;
use App\Modules\Models\Explain\Explain;
use App\Modules\Models\Explain_info\Explain_info;
use App\Modules\Models\GuideRule\GuideRule;
use App\Modules\Models\Receive\Receive;
use App\Modules\Models\Spot\Spot;
/**
* Class BaseCustomerRelationship
* @package App\Modules\Models\Customer\Traits\Relationship
*/
trait ShareRelationship
{
/**
* Consume Order Relation
*@return mixed
*/
public function spot()
{
return $this->belongsTo(Spot::class,'spot_id','id');
}
public function guideRule()
{
return $this->belongsTo(GuideRule::class,'spot_id','spot_id');
}
public function explainInfo(){
return $this->hasMany(Explain_info::class,'spot_id','spot_id');
}
public function explain(){
return $this->hasMany(Explain::class,'spot_id','spot_id');
}
public function customer(){
return $this->belongsToMany(Customer::class,'receive', 'share_id', 'customer_id');
}
}