Skip to content

Commit

Permalink
tweaks to forceFill attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
wilkerwma committed Dec 27, 2023
1 parent 909c00e commit 13ab25b
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/NovaInlineRelationship.php
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ public function getValueFromField(Field $field, NovaInlineRelationshipRequest $r
// Fill Attributes in Field
$field->fillAttribute($request, $attribute, $temp, $attribute);

return $temp->{$attribute} ?? null;
return $temp->{$attribute} ?? data_get($temp, "forceFill.{$attribute}");
}

/**
Expand Down Expand Up @@ -536,18 +536,17 @@ protected function updateFieldValue($resource, $attribute, Collection $propertie
protected function getResourceResponse(NovaRequest $request, $response, Collection $properties): array
{
return collect($response)->map(function ($itemData, $weight) use ($properties, $request) {
$item = $itemData['values'];
$modelId = $itemData['modelId'];
$item = data_get($itemData, 'values');
$modelId = data_get($itemData, 'modelId');

$fields = collect($item)->map(function ($value, $key) use ($properties, $request, $item) {
if ($properties->has($key)) {
$field = $this->getResourceField($properties->get($key), $key);
$newRequest = $this->getDuplicateRequest($request, $item);

return $this->getValueFromField($field, $newRequest, $key)
?? ($field instanceof File) && ! empty($value)
return ($field instanceof File) && ! empty($value)
? $value
: null;
: $this->getValueFromField($field, $newRequest, $key);
}

return $value;
Expand Down

0 comments on commit 13ab25b

Please sign in to comment.