Files
einundzwanzig-portal/app/Http/Livewire/Frontend/Library.php
Benjamin Takats 660c7da394 podcasts added
2022-12-06 18:17:05 +01:00

47 lines
1.1 KiB
PHP

<?php
namespace App\Http\Livewire\Frontend;
use App\Models\Country;
use App\Models\Podcast;
use Livewire\Component;
class Library extends Component
{
public Country $country;
public $currentTab = 'Alle';
protected $queryString = [
'currentTab' => ['except' => 'alle'],
];
public function render()
{
$shouldBePublic = request()
->route()
->getName() !== 'library.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.frontend.library', [
'libraries' => $tabs,
]);
}
}