Skip to content

Commit 779cfa7

Browse files
author
ricardorzgz
committed
Fixed PHP fatal error when working with Laravel Database 5.2. toArray() function only called when get() is not an array.
1 parent cd37044 commit 779cfa7

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Phpmig/Adapter/Illuminate/Database.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,11 @@ public function fetchAll()
4444
$all = $this->adapter
4545
->table($this->tableName)
4646
->orderBy('version')
47-
->get()->toArray();
47+
->get();
48+
49+
if(!is_array($all)) {
50+
$all = $all->toArray();
51+
}
4852

4953
return array_map(function($v) use($fetchMode) {
5054

0 commit comments

Comments
 (0)