Total Complexity | 8 |
Total Lines | 24 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
5 | trait ScopesTrait |
||
6 | { |
||
7 | public function scopeByClassesByNames($query, array $attributes, $key = 'name') |
||
8 | { |
||
9 | foreach ($attributes as $type => $slugs) { |
||
10 | if (! empty($slugs)) { |
||
11 | $names = is_array($slugs) ? $slugs : [$slugs]; |
||
12 | $query->orWhere('slugable_type', $type)->whereIn($key, $names); |
||
13 | } |
||
14 | } |
||
15 | |||
16 | return $query; |
||
17 | } |
||
18 | |||
19 | public function scopeByNameByClass($query, $name, $class = null) |
||
23 | } |
||
24 | |||
25 | public function scopeByNamesByClass($query, $name, $class = null) |
||
31 |