Browse Source

Fix bug in Eloquent to_array method.

Taylor Otwell 12 years ago
parent
commit
f34063c517
1 changed files with 2 additions and 0 deletions
  1. 2 0
      laravel/database/eloquent/model.php

+ 2 - 0
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();