Skip to content

Commit 5528605

Browse files
skip filter class checker (#207)
* skip filter class checker * format patch --------- Co-authored-by: Eric Tucker <[email protected]>
1 parent f265b78 commit 5528605

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

src/Filterable.php

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,23 @@ trait Filterable
2121
*/
2222
public function scopeFilter($query, array $input = [], $filter = null)
2323
{
24-
// Resolve the current Model's filter
2524
if ($filter === null) {
26-
$filter = $this->getModelFilterClass();
25+
if (class_exists($this->getModelFilterClass())) {
26+
$filter = $this->getModelFilterClass();
27+
28+
$modelFilter = new $filter($query, $input);
29+
30+
// Set the input that was used in the filter (this will exclude empty strings)
31+
$this->filtered = $modelFilter->input();
32+
33+
// Return the filter query
34+
return $modelFilter->handle();
35+
}
2736
}
2837

2938
// Create the model filter instance
30-
$modelFilter = new $filter($query, $input);
31-
32-
// Set the input that was used in the filter (this will exclude empty strings)
33-
$this->filtered = $modelFilter->input();
3439

35-
// Return the filter query
36-
return $modelFilter->handle();
40+
return $query;
3741
}
3842

3943
/**

0 commit comments

Comments
 (0)