From f34063c5175cef6909825a74cacded3b9398db91 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Wed, 29 Aug 2012 14:44:16 -0500 Subject: [PATCH] Fix bug in Eloquent to_array method. --- laravel/database/eloquent/model.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/laravel/database/eloquent/model.php b/laravel/database/eloquent/model.php index 61a7769c..4ee26264 100644 --- a/laravel/database/eloquent/model.php +++ b/laravel/database/eloquent/model.php @@ -617,6 +617,8 @@ abstract class Model { // to_array method, keying them both by name and ID. elseif (is_array($models)) { + $attributes[$name] = array(); + foreach ($models as $id => $model) { $attributes[$name][$id] = $model->to_array();