1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Staudenmeir\EloquentEagerLimitXLaravelAdjacencyList\Eloquent; |
4
|
|
|
|
5
|
|
|
use Illuminate\Database\Eloquent\Builder; |
6
|
|
|
use Illuminate\Database\Eloquent\Model; |
7
|
|
|
use Staudenmeir\EloquentEagerLimitXLaravelAdjacencyList\Eloquent\Relations\Ancestors; |
8
|
|
|
use Staudenmeir\EloquentEagerLimitXLaravelAdjacencyList\Eloquent\Relations\Bloodline; |
9
|
|
|
use Staudenmeir\EloquentEagerLimitXLaravelAdjacencyList\Eloquent\Relations\Descendants; |
10
|
|
|
use Staudenmeir\EloquentEagerLimitXLaravelAdjacencyList\Eloquent\Relations\Siblings; |
11
|
|
|
use Staudenmeir\EloquentEagerLimitXLaravelCte\Eloquent\HasEagerLimitAndQueriesExpressions; |
12
|
|
|
use Staudenmeir\LaravelAdjacencyList\Eloquent\Traits\HasAdjacencyList; |
13
|
|
|
|
14
|
|
|
trait HasEagerLimitAndRecursiveRelationships |
15
|
|
|
{ |
16
|
|
|
use HasAdjacencyList; |
17
|
|
|
use HasEagerLimitAndQueriesExpressions; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* Instantiate a new Ancestors relationship. |
21
|
|
|
* |
22
|
|
|
* @param \Illuminate\Database\Eloquent\Builder $query |
23
|
|
|
* @param \Illuminate\Database\Eloquent\Model $parent |
24
|
|
|
* @param string $foreignKey |
25
|
|
|
* @param string $localKey |
26
|
|
|
* @param bool $andSelf |
27
|
|
|
* @return \Staudenmeir\EloquentEagerLimitXLaravelAdjacencyList\Eloquent\Relations\Ancestors |
28
|
|
|
*/ |
29
|
178 |
|
protected function newAncestors(Builder $query, Model $parent, $foreignKey, $localKey, $andSelf) |
30
|
|
|
{ |
31
|
178 |
|
return new Ancestors($query, $parent, $foreignKey, $localKey, $andSelf); |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* Instantiate a new Bloodline relationship. |
36
|
|
|
* |
37
|
|
|
* @param \Illuminate\Database\Eloquent\Builder $query |
38
|
|
|
* @param \Illuminate\Database\Eloquent\Model $parent |
39
|
|
|
* @param string $foreignKey |
40
|
|
|
* @param string $localKey |
41
|
|
|
* @return \Staudenmeir\EloquentEagerLimitXLaravelAdjacencyList\Eloquent\Relations\Bloodline |
42
|
|
|
*/ |
43
|
72 |
|
protected function newBloodline(Builder $query, Model $parent, $foreignKey, $localKey) |
44
|
|
|
{ |
45
|
72 |
|
return new Bloodline($query, $parent, $foreignKey, $localKey); |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* Instantiate a new Descendants relationship. |
50
|
|
|
* |
51
|
|
|
* @param \Illuminate\Database\Eloquent\Builder $query |
52
|
|
|
* @param \Illuminate\Database\Eloquent\Model $parent |
53
|
|
|
* @param string $foreignKey |
54
|
|
|
* @param string $localKey |
55
|
|
|
* @param bool $andSelf |
56
|
|
|
* @return \Staudenmeir\EloquentEagerLimitXLaravelAdjacencyList\Eloquent\Relations\Descendants |
57
|
|
|
*/ |
58
|
176 |
|
protected function newDescendants(Builder $query, Model $parent, $foreignKey, $localKey, $andSelf) |
59
|
|
|
{ |
60
|
176 |
|
return new Descendants($query, $parent, $foreignKey, $localKey, $andSelf); |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* Instantiate a new Siblings relationship. |
65
|
|
|
* |
66
|
|
|
* @param \Illuminate\Database\Eloquent\Builder $query |
67
|
|
|
* @param \Illuminate\Database\Eloquent\Model $parent |
68
|
|
|
* @param string $foreignKey |
69
|
|
|
* @param string $localKey |
70
|
|
|
* @param bool $andSelf |
71
|
|
|
* @return \Staudenmeir\EloquentEagerLimitXLaravelAdjacencyList\Eloquent\Relations\Siblings |
72
|
|
|
*/ |
73
|
105 |
|
protected function newSiblings(Builder $query, Model $parent, $foreignKey, $localKey, $andSelf) |
74
|
|
|
{ |
75
|
105 |
|
return new Siblings($query, $parent, $foreignKey, $localKey, $andSelf); |
76
|
|
|
} |
77
|
|
|
} |
78
|
|
|
|