Skip to content

Commit

Permalink
Update sources
Browse files Browse the repository at this point in the history
bastien-phi committed Jul 8, 2020

Verified

This commit was signed with the committer’s verified signature. The key has expired.
ripcurlx Christoph Atteneder
1 parent 3dfb050 commit b2ea065
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/Factory.php
Original file line number Diff line number Diff line change
@@ -341,18 +341,20 @@ protected function parentResolvers()
*/
protected function expandAttributes(array $definition)
{
return collect($definition)->map(function ($attribute) use ($definition) {
return collect($definition)->map(function ($attribute, $key) use (&$definition) {
if (is_callable($attribute) && ! is_string($attribute) && ! is_array($attribute)) {
$attribute = $attribute($definition);
}

if ($attribute instanceof self) {
return $attribute->create()->getKey();
$attribute = $attribute->create()->getKey();
} elseif ($attribute instanceof Model) {
return $attribute->getKey();
} else {
return $attribute;
$attribute = $attribute->getKey();
}

$definition[$key] = $attribute;

return $attribute;
})->all();
}

0 comments on commit b2ea065

Please sign in to comment.