Skip to content

Commit

Permalink
refactor: Simplify condition checks in FilamentResourceTestsCommand
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeWithDennis committed Mar 30, 2024
1 parent 6e35ee5 commit 741252a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Commands/FilamentResourceTestsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,14 +212,14 @@ protected function getStubs(Resource $resource): array
}

// Check if there is a trashed filter
if ($this->getResourceTableFilterNames($resourceTable)->contains('trashed')) {
if ($this->getResourceTableFilterNames($resourceTable)->contains('trashed') && $this->hasSoftDeletes($resource)) {
// Check if there is a restore action
if ($this->hasSoftDeletes($resource) && $this->getResourceTableActionNames($resource)->contains('restore')) {
if ($this->getResourceTableActionNames($resource)->contains('restore')) {
$stubs[] = 'Restore';
}

// Check if there is a bulk restore action
if ($this->hasSoftDeletes($resource) && $this->getResourceTableBulkActionNames($resource)->contains('restore')) {
if ($this->getResourceTableBulkActionNames($resource)->contains('restore')) {
$stubs[] = 'BulkRestore';
}
}
Expand Down

0 comments on commit 741252a

Please sign in to comment.