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)
132
132
133
133
/**
134
134
* @param $field
135
+ * @param mixed $index
135
136
* @return bool
136
137
*/
137
- protected function isDuplicate ($ field )
138
+ protected function isDuplicate ($ field, $ index = null )
138
139
{
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 ) {
141
144
return true ;
142
145
}
143
146
}
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ public function addSelect($field)
36
36
{
37
37
if (is_array ($ field )) {
38
38
foreach ($ field as $ index => $ item ) {
39
- if (!$ this ->isDuplicate ($ item )) {
39
+ if (!$ this ->isDuplicate ($ item, $ index )) {
40
40
$ this ->select [$ index ] = $ item ;
41
41
}
42
42
}
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ public function addSelect($field)
36
36
{
37
37
if (is_array ($ field )) {
38
38
foreach ($ field as $ index => $ item ) {
39
- if (!$ this ->isDuplicate ($ item )) {
39
+ if (!$ this ->isDuplicate ($ item, $ index )) {
40
40
$ this ->select [$ index ] = $ item ;
41
41
}
42
42
}
You can’t perform that action at this time.
0 commit comments