| Total Complexity | 5 |
| Total Lines | 26 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 12 | trait CanBeViewed |
||
| 13 | { |
||
| 14 | /** |
||
| 15 | * @param array $values |
||
| 16 | * |
||
| 17 | * @return null|Builder |
||
| 18 | */ |
||
| 19 | 1 | public function whereRecentlyViewedIn(array $values): ?Builder |
|
| 20 | { |
||
| 21 | 1 | $values = array_filter($values, fn ($v) => (is_int($v) || is_string($v))); |
|
| 22 | |||
| 23 | 1 | if (count($values)) { |
|
| 24 | 1 | return static::whereIn($this->getKeyName(), $values); |
|
|
|
|||
| 25 | } |
||
| 26 | |||
| 27 | 1 | return null; |
|
| 28 | } |
||
| 29 | |||
| 30 | /** |
||
| 31 | * Get recently viewed items count. |
||
| 32 | * |
||
| 33 | * @return int |
||
| 34 | */ |
||
| 35 | 9 | public function getRecentlyViewsLimit(): int |
|
| 38 | } |
||
| 39 | } |
||
| 40 |