sort by coursesEvents

This commit is contained in:
Benjamin Takats
2023-01-15 15:02:15 +01:00
parent bceae06176
commit 002879b375
3 changed files with 32 additions and 25 deletions

View File

@@ -22,14 +22,18 @@ class LecturerLandingPage extends Component
{
return view('livewire.school.lecturer-landing-page', [
'courseEvents' => CourseEvent::query()
->where('from', '>=', now())
->whereHas('course', function ($query) {
$query->where('lecturer_id', $this->lecturer->id);
})
->orderBy('from')
->get(),
'events' => CourseEvent::query()
->where('from', '>=', now())
->whereHas('course', function ($query) {
$query->where('lecturer_id', $this->lecturer->id);
})
->orderBy('from')
->get()
->map(fn($event) => [
'id' => $event->id,