File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed
src/Jenssegers/Mongodb/Query Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -281,17 +281,17 @@ public function distinct($column = false)
281
281
* @param string $direction
282
282
* @return Builder
283
283
*/
284
- public function orderBy ($ column , $ direction = null )
284
+ public function orderBy ($ column , $ direction = ' asc ' )
285
285
{
286
- if (is_null ($ direction ) && $ column == 'natural ' )
286
+ $ direction = (strtolower ($ direction ) == 'asc ' ? 1 : -1 );
287
+
288
+ if ($ column == 'natural ' )
287
289
{
288
- $ this ->orders ['$natural ' ] = 1 ;
290
+ $ this ->orders ['$natural ' ] = $ direction ;
289
291
}
290
292
else
291
293
{
292
- $ direction = $ direction ?: 'asc ' ;
293
-
294
- $ this ->orders [$ column ] = (strtolower ($ direction ) == 'asc ' ? 1 : -1 );
294
+ $ this ->orders [$ column ] = $ direction ;
295
295
}
296
296
297
297
return $ this ;
You can’t perform that action at this time.
0 commit comments