mirror of
https://github.com/Einundzwanzig-Podcast/einundzwanzig-portal.git
synced 2025-12-11 06:46:47 +00:00
lecturer lib added
This commit is contained in:
@@ -17,9 +17,16 @@ class Library extends Component
|
|||||||
|
|
||||||
public function render()
|
public function render()
|
||||||
{
|
{
|
||||||
|
$shouldBePublic = request()
|
||||||
|
->route()
|
||||||
|
->getName() !== 'library.lecturer';
|
||||||
|
if (!$shouldBePublic && !auth()->user()->is_lecturer) {
|
||||||
|
abort(403);
|
||||||
|
}
|
||||||
|
|
||||||
return view('livewire.frontend.library', [
|
return view('livewire.frontend.library', [
|
||||||
'libraries' => \App\Models\Library::query()
|
'libraries' => \App\Models\Library::query()
|
||||||
->where('is_public', true)
|
->where('is_public', $shouldBePublic)
|
||||||
->get()
|
->get()
|
||||||
->prepend(\App\Models\Library::make([
|
->prepend(\App\Models\Library::make([
|
||||||
'name' => 'Alle',
|
'name' => 'Alle',
|
||||||
|
|||||||
@@ -16,6 +16,10 @@ class SearchByTagInLibrary extends Component
|
|||||||
|
|
||||||
public function render()
|
public function render()
|
||||||
{
|
{
|
||||||
|
$shouldBePublic = request()
|
||||||
|
->route()
|
||||||
|
->getName() !== 'library.lecturer';
|
||||||
|
|
||||||
return view('livewire.frontend.search-by-tag-in-library', [
|
return view('livewire.frontend.search-by-tag-in-library', [
|
||||||
'tags' => Tag::query()
|
'tags' => Tag::query()
|
||||||
->with([
|
->with([
|
||||||
@@ -26,9 +30,7 @@ class SearchByTagInLibrary extends Component
|
|||||||
'libraryItems',
|
'libraryItems',
|
||||||
])
|
])
|
||||||
->where('type', 'library_item')
|
->where('type', 'library_item')
|
||||||
->whereHas('libraryItems.libraries', function ($query) {
|
->whereHas('libraryItems.libraries', fn($query) => $query->where('is_public', $shouldBePublic))
|
||||||
$query->where('is_public', true);
|
|
||||||
})
|
|
||||||
->get(),
|
->get(),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -116,8 +116,12 @@ class LibraryItemTable extends DataTableComponent
|
|||||||
|
|
||||||
public function builder(): Builder
|
public function builder(): Builder
|
||||||
{
|
{
|
||||||
|
$shouldBePublic = request()
|
||||||
|
->route()
|
||||||
|
->getName() !== 'library.lecturer';
|
||||||
|
|
||||||
return LibraryItem::query()
|
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',
|
->when($this->currentTab !== 'Alle', fn($query) => $query->whereHas('libraries',
|
||||||
fn($query) => $query->where('libraries.name', $this->currentTab)))
|
fn($query) => $query->where('libraries.name', $this->currentTab)))
|
||||||
->withCount([
|
->withCount([
|
||||||
|
|||||||
@@ -27,8 +27,6 @@ class AppServiceProvider extends ServiceProvider
|
|||||||
*/
|
*/
|
||||||
public function boot()
|
public function boot()
|
||||||
{
|
{
|
||||||
ray()->newScreen('bitcoin');
|
|
||||||
|
|
||||||
Stringable::macro('initials', function () {
|
Stringable::macro('initials', function () {
|
||||||
$words = preg_split("/\s+/", $this);
|
$words = preg_split("/\s+/", $this);
|
||||||
$initials = "";
|
$initials = "";
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
<div>
|
<div>
|
||||||
<x-button amber>
|
@if(str($row->value)->contains('http'))
|
||||||
<i class="fa fa-thin fa-book-open mr-2"></i>
|
<x-button amber href="{{ $row->value }}" target="_blank">
|
||||||
Öffnen
|
<i class="fa fa-thin fa-book-open mr-2"></i>
|
||||||
</x-button>
|
Öffnen
|
||||||
|
</x-button>
|
||||||
|
@endif
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -33,6 +33,10 @@
|
|||||||
class="{{ request()->routeIs('search.event') ? 'text-amber-500 underline' : 'text-gray-400' }} mr-5 font-medium leading-6 hover:text-gray-300">Termine</a>
|
class="{{ request()->routeIs('search.event') ? 'text-amber-500 underline' : 'text-gray-400' }} mr-5 font-medium leading-6 hover:text-gray-300">Termine</a>
|
||||||
<a href="{{ route('library', ['country' => $c]) }}"
|
<a href="{{ route('library', ['country' => $c]) }}"
|
||||||
class="{{ request()->routeIs('library') ? 'text-amber-500 underline' : 'text-gray-400' }} mr-5 font-medium leading-6 hover:text-gray-300">Bibliothek</a>
|
class="{{ request()->routeIs('library') ? 'text-amber-500 underline' : 'text-gray-400' }} mr-5 font-medium leading-6 hover:text-gray-300">Bibliothek</a>
|
||||||
|
@if(auth()->user()->is_lecturer)
|
||||||
|
<a href="{{ route('library.lecturer', ['country' => $c]) }}"
|
||||||
|
class="{{ request()->routeIs('library.lecturer') ? 'text-amber-500 underline' : 'text-gray-400' }} mr-5 font-medium leading-6 hover:text-gray-300">Dozenten-Bibliothek</a>
|
||||||
|
@endif
|
||||||
</nav>
|
</nav>
|
||||||
</div>
|
</div>
|
||||||
@auth
|
@auth
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
@php
|
@php
|
||||||
$currentLibraryClass = $currentTab === $library->name ? 'border-amber-500 text-amber-600' : 'border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300';
|
$currentLibraryClass = $currentTab === $library->name ? 'border-amber-500 text-amber-600' : 'border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300';
|
||||||
@endphp
|
@endphp
|
||||||
<a href="{{ route('library', ['country' => $country, 'currentTab' => $library->name]) }}"
|
<a href="{{ route(request()->route()->getName(), ['country' => $country, 'currentTab' => $library->name]) }}"
|
||||||
class="{{ $currentLibraryClass }} whitespace-nowrap pb-4 px-1 border-b-2 font-medium text-sm">{{ $library->name }}</a>
|
class="{{ $currentLibraryClass }} whitespace-nowrap pb-4 px-1 border-b-2 font-medium text-sm">{{ $library->name }}</a>
|
||||||
@endforeach
|
@endforeach
|
||||||
</nav>
|
</nav>
|
||||||
|
|||||||
@@ -33,6 +33,9 @@ Route::get('/{country:code}/suche/termin', \App\Http\Livewire\Frontend\SearchEve
|
|||||||
Route::get('/{country:code}/bibliothek', \App\Http\Livewire\Frontend\Library::class)
|
Route::get('/{country:code}/bibliothek', \App\Http\Livewire\Frontend\Library::class)
|
||||||
->name('library');
|
->name('library');
|
||||||
|
|
||||||
|
Route::get('/{country:code}/dozenten/bibliothek', \App\Http\Livewire\Frontend\Library::class)
|
||||||
|
->name('library.lecturer');
|
||||||
|
|
||||||
Route::get('/dozenten', \App\Http\Livewire\Guest\Welcome::class)
|
Route::get('/dozenten', \App\Http\Livewire\Guest\Welcome::class)
|
||||||
->name('search.lecturers');
|
->name('search.lecturers');
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user