split into modules

This commit is contained in:
Benjamin Takats
2022-12-12 16:21:10 +01:00
parent 8406fe6dd2
commit d8f66f61f3
35 changed files with 259 additions and 309 deletions

View File

@@ -0,0 +1,46 @@
<?php
namespace App\Http\Livewire\Library;
use App\Models\Country;
use App\Models\Podcast;
use Livewire\Component;
class LibraryTable extends Component
{
public Country $country;
public $currentTab = 'Alle';
protected $queryString = [
'currentTab' => ['except' => 'alle'],
];
public function render()
{
$shouldBePublic = request()
->route()
->getName() !== 'library.table.lecturer';
if (!$shouldBePublic && !auth()->user()->is_lecturer) {
abort(403);
}
$libraries = \App\Models\Library::query()
->where('is_public', $shouldBePublic)
->get();
$tabs = collect([
[
'name' => 'Alle',
]
]);
foreach ($libraries as $library) {
$tabs->push([
'name' => $library->name,
]);
}
return view('livewire.library.library-table', [
'libraries' => $tabs,
]);
}
}