mirror of
https://github.com/Einundzwanzig-Podcast/einundzwanzig-portal.git
synced 2025-12-11 06:46:47 +00:00
library with grid
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
namespace App\Http\Livewire\Library;
|
namespace App\Http\Livewire\Library;
|
||||||
|
|
||||||
use App\Models\Country;
|
use App\Models\Country;
|
||||||
|
use App\Models\Library;
|
||||||
use App\Models\LibraryItem;
|
use App\Models\LibraryItem;
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
use RalphJSmit\Laravel\SEO\Support\SEOData;
|
use RalphJSmit\Laravel\SEO\Support\SEOData;
|
||||||
@@ -44,6 +45,12 @@ class LibraryTable extends Component
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($this->currentTab !== '*') {
|
||||||
|
$parentLibrary = Library::query()
|
||||||
|
->where('name', $this->currentTab)
|
||||||
|
->first();
|
||||||
|
}
|
||||||
|
|
||||||
return view('livewire.library.library-table', [
|
return view('livewire.library.library-table', [
|
||||||
'libraries' => $tabs,
|
'libraries' => $tabs,
|
||||||
'libraryItems' => LibraryItem::query()
|
'libraryItems' => LibraryItem::query()
|
||||||
@@ -51,8 +58,16 @@ class LibraryTable extends Component
|
|||||||
'lecturer',
|
'lecturer',
|
||||||
'tags',
|
'tags',
|
||||||
])
|
])
|
||||||
->when($this->currentTab !== '*', fn($query) => $query->whereHas('libraries',
|
->when($this->currentTab !== '*', fn($query) => $query
|
||||||
fn($query) => $query->where('libraries.name', $this->currentTab)))
|
->whereHas('libraries',
|
||||||
|
fn($query) => $query
|
||||||
|
->where('libraries.name', $this->currentTab)
|
||||||
|
)
|
||||||
|
->orWhereHas('libraries',
|
||||||
|
fn($query) => $query
|
||||||
|
->where('libraries.parent_id', $parentLibrary->id)
|
||||||
|
)
|
||||||
|
)
|
||||||
->when(count($this->filters) > 0, fn($query) => $query->whereHas('tags',
|
->when(count($this->filters) > 0, fn($query) => $query->whereHas('tags',
|
||||||
fn($query) => $query->whereIn('tags.id', $this->filters)))
|
fn($query) => $query->whereIn('tags.id', $this->filters)))
|
||||||
->whereHas('libraries',
|
->whereHas('libraries',
|
||||||
|
|||||||
Reference in New Issue
Block a user