Skip to content

Commit 91f7f1f

Browse files
committed
fix unit testing
1 parent 439ded7 commit 91f7f1f

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/yajra/Datatables/Datatables.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
*
88
* @package Laravel
99
* @category Package
10-
* @version 2.2.0
1110
* @author Arjay Angeles <[email protected]>
1211
*/
1312

@@ -112,7 +111,7 @@ private function getResult()
112111
$this->result_array = array_map(function($object) { return (array) $object; }, $this->result_object->toArray());
113112
}
114113
else {
115-
$this->result_array = array_map(function($object) { return (array) $object; }, (array) $this->result_object);
114+
$this->result_array = array_map(function($object) { return (array) $object; }, $this->result_object);
116115
}
117116
}
118117

@@ -210,7 +209,12 @@ private function initColumns()
210209
// Convert data array to object value
211210
$data = array();
212211
foreach ($rvalue as $key => $value) {
213-
$data[$key] = $this->result_object[$rkey]->$key;
212+
if ( is_object($this->result_object[$rkey]) ) {
213+
$data[$key] = $this->result_object[$rkey]->$key;
214+
}
215+
else {
216+
$data[$key] = $value;
217+
}
214218
}
215219

216220
// Process add columns
@@ -222,7 +226,7 @@ private function initColumns()
222226
$value['content'] = $value['content']($this->result_object[$rkey]);
223227
endif;
224228

225-
$rvalue = $this->includeInArray($value,$rvalue);
229+
$rvalue = $this->includeInArray($value,$data);
226230
}
227231

228232
// Process edit columns

0 commit comments

Comments
 (0)