| Total Complexity | 5 |
| Total Lines | 40 |
| 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 | * @return $this |
||
| 14 | */ |
||
| 15 | public function whereTrackableId($trackable_id): self |
||
| 16 | { |
||
| 17 | $trackable_id = (array) $trackable_id; |
||
| 18 | $this->where(function (self $query) use ($trackable_id) { |
||
|
|
|||
| 19 | foreach ($trackable_id as $key) { |
||
| 20 | $query->orWhere('trackable_id', '=', $key); |
||
| 21 | } |
||
| 22 | }); |
||
| 23 | |||
| 24 | return $this; |
||
| 25 | } |
||
| 26 | |||
| 27 | /** |
||
| 28 | * Scope query to activity on a specific trackable type. |
||
| 29 | * |
||
| 30 | * @param mixed $trackable_type |
||
| 31 | * @return $this |
||
| 32 | */ |
||
| 33 | public function whereTrackableType($trackable_type): self |
||
| 47 | } |
||
| 48 | } |
||
| 49 |