Fix Eloquent eager loading matching.

This commit is contained in:
Taylor Otwell
2012-04-23 16:08:57 -05:00
parent b65fa7040d
commit 94948cf675
8 changed files with 53 additions and 42 deletions

View File

@@ -101,4 +101,22 @@ abstract class Relationship extends Query {
return static::foreign($this->base, $this->foreign);
}
/**
* Gather all the primary keys from a result set.
*
* @param array $results
* @return array
*/
public function keys($results)
{
$keys = array();
foreach ($results as $result)
{
$keys[] = $result->get_key();
}
return array_unique($keys);
}
}