Skip to content

Commit

Permalink
Merge pull request #112 from gazben/patch-1
Browse files Browse the repository at this point in the history
Fill key attribute if not filled
  • Loading branch information
yassilah authored Dec 10, 2020
2 parents fcc22f6 + 7fc557e commit 09ac336
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/NestedForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,9 @@ protected function fillAttributeFromRequest(NovaRequest $request, $requestAttrib
{
if ($model->exists) {
$newRequest = NovaRequest::createFrom($request);
if (!$model->{$model->getKeyName() && $request->has($model->getKeyName())}) {
$model->{$model->getKeyName()} = $request->get($model->getKeyName());
}
$children = collect($newRequest->get($requestAttribute));
$newRequest->route()->setParameter('resource', $this->resourceName);
$this->deleteChildren($newRequest, $model, $children);
Expand Down

0 comments on commit 09ac336

Please sign in to comment.