Skip to content

Commit e3a000a

Browse files
committed
Fix Query::lists() for empty resultsets
1 parent 1bd157d commit e3a000a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

laravel/database/query.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,7 @@ public function lists($column, $key = null)
605605
// set the keys on the array of values using the array_combine
606606
// function provided by PHP, which should give us the proper
607607
// array form to return from the method.
608-
if ( ! is_null($key))
608+
if ( ! is_null($key) && count($results))
609609
{
610610
return array_combine(array_map(function($row) use ($key)
611611
{

0 commit comments

Comments
 (0)