Total Complexity | 5 |
Total Lines | 42 |
Duplicated Lines | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
7 | trait WhereModels |
||
8 | { |
||
9 | /** |
||
10 | * Scope query to activity on a specific trackable id. |
||
11 | * |
||
12 | * @param mixed $trackable_id |
||
13 | * |
||
14 | * @return $this |
||
15 | */ |
||
16 | public function whereTrackableId($trackable_id): self |
||
17 | { |
||
18 | $trackable_id = (array) $trackable_id; |
||
19 | $this->where(function (self $query) use ($trackable_id) { |
||
|
|||
20 | foreach ($trackable_id as $key) { |
||
21 | $query->orWhere('trackable_id', '=', $key); |
||
22 | } |
||
23 | }); |
||
24 | |||
25 | return $this; |
||
26 | } |
||
27 | |||
28 | /** |
||
29 | * Scope query to activity on a specific trackable type. |
||
30 | * |
||
31 | * @param mixed $trackable_type |
||
32 | * |
||
33 | * @return $this |
||
34 | */ |
||
35 | public function whereTrackableType($trackable_type): self |
||
49 | } |
||
50 | } |
||
51 |