Browse Source

use array_values on relationship matches.

Taylor Otwell 12 years ago
parent
commit
9cee86ffb9

+ 1 - 1
laravel/database/eloquent/relationships/has_many.php

@@ -98,7 +98,7 @@ class Has_Many extends Has_One_Or_Many {
 				return $v->$foreign == $parent->get_key();
 			});
 
-			$parent->relationships[$relationship] = $matching;
+			$parent->relationships[$relationship] = array_values($matching);
 		}
 	}
 

+ 1 - 1
laravel/database/eloquent/relationships/has_many_and_belongs_to.php

@@ -332,7 +332,7 @@ class Has_Many_And_Belongs_To extends Relationship {
 				return $v->pivot->$foreign == $parent->get_key();
 			});
 
-			$parent->relationships[$relationship] = $matching;
+			$parent->relationships[$relationship] = array_values($matching);
 		}
 	}