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()
|
||||
{
|
||||
$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',
|
||||
|
||||
@@ -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(),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -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([
|
||||
|
||||
@@ -27,8 +27,6 @@ class AppServiceProvider extends ServiceProvider
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
ray()->newScreen('bitcoin');
|
||||
|
||||
Stringable::macro('initials', function () {
|
||||
$words = preg_split("/\s+/", $this);
|
||||
$initials = "";
|
||||
|
||||
Reference in New Issue
Block a user