Skip to content

Commit

Permalink
fix: 🐛 build
Browse files Browse the repository at this point in the history
Closes: #112 #111
  • Loading branch information
yassilah committed Dec 10, 2020
2 parents 191567a + 09ac336 commit 054c1c4
Show file tree
Hide file tree
Showing 4 changed files with 1,670 additions and 10,514 deletions.
2 changes: 1 addition & 1 deletion dist/js/field.js

Large diffs are not rendered by default.

6 changes: 6 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 Expand Up @@ -480,6 +483,9 @@ protected function getDetachRequest(NovaRequest $request, $model, $children)
protected function getDeleteRequest(NovaRequest $request, $model, $children)
{
return DeleteResourceRequest::createFrom($request->replace([
'viaResource' => null,
'viaResourceId' => null,
'viaRelationship' => null,
'resources' => $model->{$this->viaRelationship}()->whereNotIn($this->keyName, $children->pluck($this->keyName))->pluck($this->keyName)
]));
}
Expand Down
Loading

0 comments on commit 054c1c4

Please sign in to comment.