@@ -364,6 +364,31 @@ public function whereExact($column, $value)
364364 }
365365
366366
367+ /**
368+ * @param $column
369+ * @param $callBack
370+ *
371+ * @return $this
372+ */
373+ public function queryNested ($ column , $ callBack )
374+ {
375+ $ boolean = 'and ' ;
376+ $ query = $ this ->newQuery ();
377+ $ callBack ($ query );
378+ $ wheres = $ query ->compileWheres ();
379+ $ options = $ query ->compileOptions ();
380+ $ this ->wheres [] = [
381+ 'column ' => $ column ,
382+ 'type ' => 'QueryNested ' ,
383+ 'wheres ' => $ wheres ,
384+ 'options ' => $ options ,
385+ 'boolean ' => $ boolean ,
386+ ];
387+
388+ return $ this ;
389+ }
390+
391+
367392 //----------------------------------------------------------------------
368393 // Query Processing (Connection API)
369394 //----------------------------------------------------------------------
@@ -544,6 +569,65 @@ public function orderByDesc($column, $mode = null, $missing = null)
544569 return $ this ->orderBy ($ column , 'desc ' , $ mode , $ missing );
545570 }
546571
572+ /**
573+ * @param $column
574+ * @param $pin
575+ * @param $direction @values: 'asc', 'desc'
576+ * @param $unit @values: 'km', 'mi', 'm', 'ft'
577+ * @param $mode @values: 'min', 'max', 'avg', 'sum'
578+ * @param $type @values: 'arc', 'plane'
579+ *
580+ * @return $this
581+ */
582+ public function orderByGeo ($ column , $ pin , $ direction = 'asc ' , $ unit = 'km ' , $ mode = null , $ type = null )
583+ {
584+ $ this ->orders [$ column ] = [
585+ 'is_geo ' => true ,
586+ 'order ' => $ direction ,
587+ 'pin ' => $ pin ,
588+ 'unit ' => $ unit ,
589+ 'mode ' => $ mode ,
590+ 'type ' => $ type ,
591+ ];
592+
593+ return $ this ;
594+ }
595+
596+ /**
597+ * @param $column
598+ * @param $pin
599+ * @param $unit @values: 'km', 'mi', 'm', 'ft'
600+ * @param $mode @values: 'min', 'max', 'avg', 'sum'
601+ * @param $type @values: 'arc', 'plane'
602+ *
603+ * @return $this
604+ */
605+ public function orderByGeoDesc ($ column , $ pin , $ unit = 'km ' , $ mode = null , $ type = null )
606+ {
607+ return $ this ->orderByGeo ($ column , $ pin , 'desc ' , $ unit , $ mode , $ type );
608+ }
609+
610+
611+ /**
612+ * @param $column
613+ * @param $direction
614+ * @param $mode
615+ *
616+ * @return $this
617+ */
618+ public function orderByNested ($ column , $ direction = 'asc ' , $ mode = null )
619+ {
620+ $ this ->orders [$ column ] = [
621+ 'is_nested ' => true ,
622+ 'order ' => $ direction ,
623+ 'mode ' => $ mode ,
624+
625+ ];
626+
627+ return $ this ;
628+ }
629+
630+
547631 /**
548632 * @inheritdoc
549633 */
@@ -843,6 +927,18 @@ protected function _parseWhereNested(array $where)
843927
844928 }
845929
930+ protected function _parseWhereQueryNested (array $ where )
931+ {
932+ return [
933+ $ where ['column ' ] => [
934+ 'innerNested ' => [
935+ 'wheres ' => $ where ['wheres ' ],
936+ 'options ' => $ where ['options ' ],
937+ ],
938+ ],
939+ ];
940+ }
941+
846942 /**
847943 * @param array $where
848944 *
0 commit comments