Anschrift für Veranstaltungsort

This commit is contained in:
2026-09-10 11:45:52 +02:00
parent 70a57d10f5
commit ddfaab1501
19 changed files with 306 additions and 10 deletions
+16
View File
@@ -19,6 +19,8 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
* @property int $cost_unit_id
* @property string $name
* @property string $location
* @property string|null $street
* @property string|null $house_number
* @property string $postal_code
* @property string $email
* @property DateTime $start_date
@@ -59,6 +61,8 @@ class Event extends InstancedModel
'name',
'identifier',
'location',
'street',
'house_number',
'postal_code',
'email',
'start_date',
@@ -131,6 +135,18 @@ class Event extends InstancedModel
'swimming_permission_required' => 'boolean',
];
/**
* Anschrift des Veranstaltungsorts in einer Zeile. Straße und Hausnummer sind optional -- fehlen sie,
* bleibt es bei der bisherigen Ausgabe "PLZ Ort".
*/
public function getFullAddress(): string
{
$city = trim($this->postal_code . ' ' . $this->location);
$street = trim($this->street . ' ' . $this->house_number);
return '' === $street ? $city : $street . ', ' . $city;
}
public function tenant(): BelongsTo
{
return $this->belongsTo(Tenant::class, 'tenant', 'slug');