Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
11 / 11 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
BelongsToManyOrderable | |
100.00% |
11 / 11 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
__construct | |
100.00% |
11 / 11 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | |
3 | namespace Baril\Orderly\Relations; |
4 | |
5 | use Illuminate\Database\Eloquent\Builder; |
6 | use Illuminate\Database\Eloquent\Model; |
7 | use Illuminate\Database\Eloquent\Relations\BelongsToMany; |
8 | |
9 | /** |
10 | * Many to many relation with ordering support. |
11 | */ |
12 | class BelongsToManyOrderable extends BelongsToMany |
13 | { |
14 | use Concerns\InteractsWithOrderablePivotTable; |
15 | |
16 | /** |
17 | * Create a new belongs to many relationship instance. |
18 | * Sets default ordering by $orderColumn column. |
19 | * |
20 | * @param Builder $query |
21 | * @param Model $parent |
22 | * @param string $orderColumn |
23 | * @param string $table |
24 | * @param string $foreignPivotKey |
25 | * @param string $relatedPivotKey |
26 | * @param string $parentKey |
27 | * @param string $relatedKey |
28 | * @param string $relationName |
29 | */ |
30 | public function __construct( |
31 | Builder $query, |
32 | Model $parent, |
33 | $orderColumn, |
34 | $table, |
35 | $foreignPivotKey, |
36 | $relatedPivotKey, |
37 | $parentKey, |
38 | $relatedKey, |
39 | $relationName = null |
40 | ) { |
41 | parent::__construct( |
42 | $query, |
43 | $parent, |
44 | $table, |
45 | $foreignPivotKey, |
46 | $relatedPivotKey, |
47 | $parentKey, |
48 | $relatedKey, |
49 | $relationName |
50 | ); |
51 | $this->setOrderColumn($orderColumn); |
52 | } |
53 | } |