Conditions | 3 |
Paths | 3 |
Total Lines | 13 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 5 |
CRAP Score | 3.2098 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
33 | 1 | public function local(string $searchable): int |
|
34 | { |
||
35 | 1 | if (($instance = new $searchable) instanceof SearchableCountableContract) { |
|
36 | $count = $instance->getSearchableCount(); |
||
37 | } else { |
||
38 | 1 | $softDeletes = in_array(SoftDeletes::class, class_uses_recursive($searchable), true) && config('scout.soft_delete', false); |
|
39 | |||
40 | $count = $searchable::query()->when($softDeletes, function ($query) { |
||
41 | $query->withTrashed(); |
||
42 | 1 | })->count(); |
|
43 | } |
||
44 | |||
45 | 1 | return (int) $count; |
|
46 | } |
||
61 |