Files
einundzwanzig-portal/app/Http/Livewire/News/AuthorsOverview.php
HolgerHatGarKeineNode 5f677d3a2c autors overview
2023-03-15 16:07:57 +01:00

24 lines
721 B
PHP

<?php
namespace App\Http\Livewire\News;
use App\Models\Lecturer;
use Livewire\Component;
class AuthorsOverview extends Component
{
public function render()
{
return view('livewire.news.authors-overview', [
'authors' => Lecturer::query()
->whereHas('libraryItems', function ($query) {
$query->where('library_items.news', true);
})
->withCount([
'libraryItems' => fn($query) => $query->where('library_items.news', true),
])
->get(),
]);
}
}