File tree 1 file changed +12
-8
lines changed 1 file changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -21,19 +21,23 @@ trait Filterable
21
21
*/
22
22
public function scopeFilter ($ query , array $ input = [], $ filter = null )
23
23
{
24
- // Resolve the current Model's filter
25
24
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
+ }
27
36
}
28
37
29
38
// 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 ();
34
39
35
- // Return the filter query
36
- return $ modelFilter ->handle ();
40
+ return $ query ;
37
41
}
38
42
39
43
/**
You can’t perform that action at this time.
0 commit comments