Skip to content

Commit

Permalink
Merge pull request #70 from tailflow/hotfix/force-deleting-trashed-en…
Browse files Browse the repository at this point in the history
…tities

fix: force deleting a batch of trashed entities
  • Loading branch information
alexzarbn authored Mar 29, 2021
2 parents 063f7c7 + b535228 commit 0fd5f65
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions src/Concerns/HandlesStandardBatchOperations.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public function batchDestroy(Request $request)

$requestedRelations = $this->relationsResolver->requestedRelations($request);

$query = $this->buildBatchDestroyFetchQuery($request, $requestedRelations);
$query = $this->buildBatchDestroyFetchQuery($request, $requestedRelations, $softDeletes);
$entities = $this->runBatchDestroyFetchQuery($request, $query);

foreach ($entities as $entity) {
Expand Down Expand Up @@ -189,11 +189,15 @@ public function batchDestroy(Request $request)
*
* @param Request $request
* @param array $requestedRelations
* @param bool $softDeletes
* @return Builder
*/
protected function buildBatchDestroyFetchQuery(Request $request, array $requestedRelations): Builder
protected function buildBatchDestroyFetchQuery(Request $request, array $requestedRelations, bool $softDeletes): Builder
{
return $this->buildBatchFetchQuery($request, $requestedRelations);
return $this->buildBatchFetchQuery($request, $requestedRelations)
->when($softDeletes, function ($query) {
$query->withTrashed();
});
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Testing/InteractsWithResources.php
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ protected function buildMetaLink(?string $url, $label, bool $active): array
{
return [
'url' => $url,
'label' => $label,
'label' => (string) $label,
'active' => $active
];
}
Expand Down

0 comments on commit 0fd5f65

Please sign in to comment.