Commit b7ac6674 authored by Taylor Otwell's avatar Taylor Otwell

tweak belongs to eager constraining.

parent f6388e26
......@@ -65,7 +65,10 @@ class Belongs_To extends Relationship {
// are looking for the parent of a child model in this relationship.
foreach ($results as $result)
{
$keys[] = $result->{$this->foreign_key()};
if ( ! is_null($key = $result->{$this->foreign_key()}))
{
$keys[] = $key;
}
}
$this->table->where_in($this->model->key(), array_unique($keys));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment