diff --git a/app/Http/Livewire/Frontend/Library.php b/app/Http/Livewire/Frontend/Library.php index 389ca49b..796daee8 100644 --- a/app/Http/Livewire/Frontend/Library.php +++ b/app/Http/Livewire/Frontend/Library.php @@ -17,9 +17,16 @@ class Library extends Component public function render() { + $shouldBePublic = request() + ->route() + ->getName() !== 'library.lecturer'; + if (!$shouldBePublic && !auth()->user()->is_lecturer) { + abort(403); + } + return view('livewire.frontend.library', [ 'libraries' => \App\Models\Library::query() - ->where('is_public', true) + ->where('is_public', $shouldBePublic) ->get() ->prepend(\App\Models\Library::make([ 'name' => 'Alle', diff --git a/app/Http/Livewire/Frontend/SearchByTagInLibrary.php b/app/Http/Livewire/Frontend/SearchByTagInLibrary.php index a5f9232a..9712baa6 100644 --- a/app/Http/Livewire/Frontend/SearchByTagInLibrary.php +++ b/app/Http/Livewire/Frontend/SearchByTagInLibrary.php @@ -16,6 +16,10 @@ class SearchByTagInLibrary extends Component public function render() { + $shouldBePublic = request() + ->route() + ->getName() !== 'library.lecturer'; + return view('livewire.frontend.search-by-tag-in-library', [ 'tags' => Tag::query() ->with([ @@ -26,9 +30,7 @@ class SearchByTagInLibrary extends Component 'libraryItems', ]) ->where('type', 'library_item') - ->whereHas('libraryItems.libraries', function ($query) { - $query->where('is_public', true); - }) + ->whereHas('libraryItems.libraries', fn($query) => $query->where('is_public', $shouldBePublic)) ->get(), ]); } diff --git a/app/Http/Livewire/Tables/LibraryItemTable.php b/app/Http/Livewire/Tables/LibraryItemTable.php index f3271f98..0a62b121 100644 --- a/app/Http/Livewire/Tables/LibraryItemTable.php +++ b/app/Http/Livewire/Tables/LibraryItemTable.php @@ -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([ diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 8c50b370..7db859b1 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -27,8 +27,6 @@ class AppServiceProvider extends ServiceProvider */ public function boot() { - ray()->newScreen('bitcoin'); - Stringable::macro('initials', function () { $words = preg_split("/\s+/", $this); $initials = ""; diff --git a/resources/views/columns/library_items/action.blade.php b/resources/views/columns/library_items/action.blade.php index 2e7acb1a..1dc5d05f 100644 --- a/resources/views/columns/library_items/action.blade.php +++ b/resources/views/columns/library_items/action.blade.php @@ -1,6 +1,8 @@
- - - Öffnen - + @if(str($row->value)->contains('http')) + + + Öffnen + + @endif
diff --git a/resources/views/livewire/frontend/header.blade.php b/resources/views/livewire/frontend/header.blade.php index da6330b7..a7091013 100644 --- a/resources/views/livewire/frontend/header.blade.php +++ b/resources/views/livewire/frontend/header.blade.php @@ -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 Bibliothek + @if(auth()->user()->is_lecturer) + Dozenten-Bibliothek + @endif @auth diff --git a/resources/views/livewire/frontend/library.blade.php b/resources/views/livewire/frontend/library.blade.php index d0bb2f79..3b6befd9 100644 --- a/resources/views/livewire/frontend/library.blade.php +++ b/resources/views/livewire/frontend/library.blade.php @@ -28,7 +28,7 @@ @php $currentLibraryClass = $currentTab === $library->name ? 'border-amber-500 text-amber-600' : 'border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300'; @endphp - {{ $library->name }} @endforeach diff --git a/routes/web.php b/routes/web.php index ed076b20..befa782e 100644 --- a/routes/web.php +++ b/routes/web.php @@ -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) ->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) ->name('search.lecturers');