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)
281281 * @param string $direction
282282 * @return Builder
283283 */
284- public function orderBy ($ column , $ direction = null )
284+ public function orderBy ($ column , $ direction = ' asc ' )
285285 {
286- if (is_null ($ direction ) && $ column == 'natural ' )
286+ $ direction = (strtolower ($ direction ) == 'asc ' ? 1 : -1 );
287+
288+ if ($ column == 'natural ' )
287289 {
288- $ this ->orders ['$natural ' ] = 1 ;
290+ $ this ->orders ['$natural ' ] = $ direction ;
289291 }
290292 else
291293 {
292- $ direction = $ direction ?: 'asc ' ;
293-
294- $ this ->orders [$ column ] = (strtolower ($ direction ) == 'asc ' ? 1 : -1 );
294+ $ this ->orders [$ column ] = $ direction ;
295295 }
296296
297297 return $ this ;
You can’t perform that action at this time.
0 commit comments