This commit is contained in:
Toby Zerner 2019-08-07 16:29:04 +00:00
parent 0d43544adc
commit 545277e425
2 changed files with 13 additions and 7 deletions

View File

@ -132,12 +132,18 @@ trait SavesData
$value = &$data[$field->location][$name];
if ($field instanceof Schema\Relationship) {
$value = $value['data'];
if ($value) {
if ($field instanceof Schema\HasOne) {
$value = $this->getModelForIdentifier($request, $value['data']);
$value = $this->getModelForIdentifier($request, $value);
} elseif ($field instanceof Schema\HasMany) {
$value = array_map(function ($identifier) use ($request) {
return $this->getModelForIdentifier($request, $identifier);
}, $value['data']);
}, $value);
}
}
}
}
}

View File

@ -81,7 +81,7 @@ class Index implements RequestHandlerInterface
$paginationLinks[] = new Link\PrevLink($this->buildUrl($request, $params));
}
if ($schema->countable) {
if ($schema->countable && $schema->paginate) {
$total = $adapter->count($query);
$members[] = new Meta('total', $total);