mirror of
https://github.com/Einundzwanzig-Podcast/einundzwanzig-portal.git
synced 2025-12-11 06:46:47 +00:00
lecturer landing pages added
This commit is contained in:
44
app/Http/Livewire/School/LecturerLandingPage.php
Normal file
44
app/Http/Livewire/School/LecturerLandingPage.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Livewire\School;
|
||||
|
||||
use App\Models\Country;
|
||||
use App\Models\CourseEvent;
|
||||
use App\Models\Lecturer;
|
||||
use Livewire\Component;
|
||||
|
||||
class LecturerLandingPage extends Component
|
||||
{
|
||||
public Lecturer $lecturer;
|
||||
public Country $country;
|
||||
|
||||
public ?int $year = null;
|
||||
public ?int $activeEvent = null;
|
||||
|
||||
protected $queryString = ['year'];
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.school.lecturer-landing-page', [
|
||||
'courseEvents' => CourseEvent::query()
|
||||
->get(),
|
||||
'events' => CourseEvent::query()
|
||||
->whereHas('course', function ($query) {
|
||||
$query->where('lecturer_id', $this->lecturer->id);
|
||||
})
|
||||
->get()
|
||||
->map(fn($event) => [
|
||||
'id' => $event->id,
|
||||
'startDate' => $event->from,
|
||||
'endDate' => $event->to,
|
||||
'location' => $event->course->name,
|
||||
'description' => $event->venue->name,
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
public function showEvent($id)
|
||||
{
|
||||
$this->activeEvent = $id;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user