File tree Expand file tree Collapse file tree 2 files changed +27
-1
lines changed
Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -315,7 +315,8 @@ protected function prepareResult($data)
315315 }
316316 } elseif (is_array ($ data ) && count ($ data ) != 0 ) {
317317 // $value = json_decode(json_encode($this->takeColumn($data)), true);
318- $ output = $ this ->instanceWithValue ($ data , ['_select ' => $ this ->_select , '_except ' => $ this ->_except ]);
318+ //$output = $this->instanceWithValue($data, ['_select' => $this->_select, '_except' => $this->_except]);
319+ $ output = $ this ->takeColumn ($ data );
319320 } else {
320321 $ output = $ data ;
321322 }
Original file line number Diff line number Diff line change @@ -409,6 +409,31 @@ public function countGroupBy($column)
409409 return $ this ;
410410 }
411411
412+
413+ /**
414+ * getting distinct data from specific column
415+ *
416+ * @param string $column
417+ * @return $this
418+ * @throws ConditionNotAllowedException
419+ */
420+ public function distinct ($ column )
421+ {
422+ $ this ->prepare ();
423+
424+ $ data = [];
425+ foreach ($ this ->_map as $ map ) {
426+ $ value = $ this ->getFromNested ($ map , $ column );
427+ if ($ value && !array_key_exists ($ value , $ data )) {
428+ $ data [$ value ] = $ map ;
429+ }
430+ }
431+
432+ $ this ->_map = array_values ($ data );
433+ return $ this ;
434+ }
435+
436+
412437 /**
413438 * count prepared data
414439 *
You can’t perform that action at this time.
0 commit comments