relationships[$relationship] = null; } } /** * Match eagerly loaded child models to their parent models. * * @param array $parents * @param array $children * @return void */ public function match($relationship, &$parents, $children) { $foreign = $this->foreign_key(); foreach ($children as $key => $child) { $parents[$child->$foreign]->relationships[$relationship] = $child; } } }