lecturer lib added

This commit is contained in:
Benjamin Takats
2022-12-05 20:49:00 +01:00
parent fd2dee5590
commit cf9939543e
8 changed files with 32 additions and 12 deletions

View File

@@ -116,8 +116,12 @@ class LibraryItemTable extends DataTableComponent
public function builder(): Builder
{
$shouldBePublic = request()
->route()
->getName() !== 'library.lecturer';
return LibraryItem::query()
->whereHas('libraries', fn($query) => $query->where('libraries.is_public', true))
->whereHas('libraries', fn($query) => $query->where('libraries.is_public', $shouldBePublic))
->when($this->currentTab !== 'Alle', fn($query) => $query->whereHas('libraries',
fn($query) => $query->where('libraries.name', $this->currentTab)))
->withCount([