Conditions | 3 |
Paths | 3 |
Total Lines | 13 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 12 |
Changes | 0 |
1 | <?php |
||
33 | public function local(string $searchable): int |
||
34 | { |
||
35 | if (($instance = new $searchable) instanceof SearchableCountableContract) { |
||
36 | $count = $instance->getSearchableCount(); |
||
37 | } else { |
||
38 | $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 | })->count(); |
||
43 | } |
||
44 | |||
45 | return (int) $count; |
||
46 | } |
||
61 |