File tree Expand file tree Collapse file tree 3 files changed +8
-5
lines changed
Expand file tree Collapse file tree 3 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -132,12 +132,15 @@ private function isArrayAssociative($array)
132132
133133 /**
134134 * @param $field
135+ * @param mixed $index
135136 * @return bool
136137 */
137- protected function isDuplicate ($ field )
138+ protected function isDuplicate ($ field, $ index = null )
138139 {
139- foreach ($ this ->getSelect () as $ item ) {
140- if ($ item === $ field ) {
140+ foreach ($ this ->getSelect () as $ itemIndex => $ item ) {
141+ $ indexCheck = !is_null ($ index ) && is_array ($ field );
142+
143+ if ((($ indexCheck && $ index === $ itemIndex ) || !$ indexCheck ) && $ item === $ field ) {
141144 return true ;
142145 }
143146 }
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ public function addSelect($field)
3636 {
3737 if (is_array ($ field )) {
3838 foreach ($ field as $ index => $ item ) {
39- if (!$ this ->isDuplicate ($ item )) {
39+ if (!$ this ->isDuplicate ($ item, $ index )) {
4040 $ this ->select [$ index ] = $ item ;
4141 }
4242 }
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ public function addSelect($field)
3636 {
3737 if (is_array ($ field )) {
3838 foreach ($ field as $ index => $ item ) {
39- if (!$ this ->isDuplicate ($ item )) {
39+ if (!$ this ->isDuplicate ($ item, $ index )) {
4040 $ this ->select [$ index ] = $ item ;
4141 }
4242 }
You can’t perform that action at this time.
0 commit comments