Skip to content

Commit

Permalink
Introduce new uses_without_trashed() helper (#251)
Browse files Browse the repository at this point in the history
* Introduce a new helper uses_without_trashed

* Makes Captain displayWithTrashed conditional for Ships relationships
  • Loading branch information
jeremynikolic authored Sep 19, 2024
1 parent 266ac72 commit 6853144
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/Nova/Captain.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ public function fields(NovaRequest $request): array
];
})
->prunable()
->searchable(uses_searchable()),
->searchable(uses_searchable())
->displaysWithTrashed(! uses_without_trashed()),
];
}

Expand Down
1 change: 1 addition & 0 deletions app/Providers/AppServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public function register()
$this->app->instance('uses_inline_create', file_exists(base_path('.inline-create')));
$this->app->instance('uses_with_reordering', ! file_exists(base_path('.disable-reordering')));
$this->app->instance('uses_breadcrumbs', ! file_exists(base_path('.disable-breadcrumbs')));
$this->app->instance('uses_without_trashed', file_exists(base_path('.without-trashed')));
}

/**
Expand Down
5 changes: 5 additions & 0 deletions bootstrap/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,8 @@ function uses_without_reordering()
{
return ! app('uses_with_reordering');
}

function uses_without_trashed()
{
return app('uses_without_trashed');
}

0 comments on commit 6853144

Please sign in to comment.