Ignore hidden relationships in to_array().

This commit is contained in:
Franz Liedke 2012-11-23 03:23:13 +01:00
parent d2fefa65aa
commit ff4b43c72f
1 changed files with 3 additions and 0 deletions

View File

@ -615,6 +615,9 @@ public function to_array()
foreach ($this->relationships as $name => $models)
{
// Relationships can be marked as "hidden", too.
if (in_array($name, static::$hidden)) continue;
// If the relationship is not a "to-many" relationship, we can just
// to_array the related model and add it as an attribute to the
// array of existing regular attributes we gathered.