mirror of
https://github.com/Einundzwanzig-Podcast/einundzwanzig-portal.git
synced 2025-12-11 06:46:47 +00:00
Shift automatically applies the Laravel coding style - which uses the PSR-12 coding style as a base with some minor additions. You may customize the code style applied by configuring [Pint](https://laravel.com/docs/pint), [PHP CS Fixer](https://github.com/FriendsOfPHP/PHP-CS-Fixer), or [PHP CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) for your project root. For more information on customizing the code style applied by Shift, [watch this short video](https://laravelshift.com/videos/shift-code-style).
60 lines
2.2 KiB
PHP
60 lines
2.2 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Livewire\School;
|
|
|
|
use App\Models\Country;
|
|
use App\Models\CourseEvent;
|
|
use App\Models\Lecturer;
|
|
use Livewire\Component;
|
|
use RalphJSmit\Laravel\SEO\Support\SEOData;
|
|
|
|
class LecturerLandingPage extends Component
|
|
{
|
|
public Lecturer $lecturer;
|
|
|
|
public Country $country;
|
|
|
|
public ?int $year = null;
|
|
|
|
public ?int $activeEvent = null;
|
|
|
|
public function render()
|
|
{
|
|
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,
|
|
'startDate' => $event->from,
|
|
'endDate' => $event->to,
|
|
'location' => $event->course->name,
|
|
'description' => $event->venue->name,
|
|
]),
|
|
])
|
|
->layout('layouts.guest', [
|
|
'SEOData' => new SEOData(
|
|
title: $this->lecturer->name,
|
|
description: $this->lecturer->intro ?? __('This lecturer has not yet written an introduction.'),
|
|
image: $this->lecturer->getFirstMediaUrl('avatar'),
|
|
),
|
|
]);
|
|
}
|
|
|
|
public function showEvent($id)
|
|
{
|
|
$this->activeEvent = $id;
|
|
}
|
|
}
|