File tree 1 file changed +4
-4
lines changed
1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -144,13 +144,13 @@ private function buildQuery(Request $request)
144
144
$ orderByField = $ request ->get ('orderByField ' );
145
145
$ orderByDirection = $ request ->get ('orderByDirection ' );
146
146
147
- if (!in_array (strtolower ($ orderByDirection ), ['asc ' , 'desc ' ])) {
148
- throw new InvalidArgumentException ('Order by direction must be either asc or desc. ' );
149
- }
150
-
151
147
$ query = $ this ->model ->query ();
152
148
153
149
if ($ orderByField && $ orderByDirection ) {
150
+ if (!in_array (strtolower ($ orderByDirection ), ['asc ' , 'desc ' ])) {
151
+ throw new InvalidArgumentException ('Order by direction must be either asc or desc. ' );
152
+ }
153
+
154
154
if (in_array ($ orderByField , array_keys ($ this ->orderByOverrides ))) {
155
155
call_user_func_array (
156
156
$ this ->orderByOverrides [$ orderByField ],
You can’t perform that action at this time.
0 commit comments