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