Merge pull request #1467 from franzliedke/patch-60
[Eloquent] Allow hiding relationships
This commit is contained in:
commit
d1efd44c7c
|
@ -615,6 +615,9 @@ public function to_array()
|
||||||
|
|
||||||
foreach ($this->relationships as $name => $models)
|
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
|
// 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
|
// to_array the related model and add it as an attribute to the
|
||||||
// array of existing regular attributes we gathered.
|
// array of existing regular attributes we gathered.
|
||||||
|
|
Loading…
Reference in New Issue