Skip to content

Commit 0a994a4

Browse files
authored
Merge pull request #56 from HiEventsDev/develop
Add schema.org EventReservation to ticket email
2 parents 3e7636b + 092c7e9 commit 0a994a4

File tree

3 files changed

+64
-1
lines changed

3 files changed

+64
-1
lines changed

backend/app/DomainObjects/EventSettingDomainObject.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
namespace HiEvents\DomainObjects;
44

5+
use HiEvents\DataTransferObjects\AddressDTO;
6+
57
class EventSettingDomainObject extends Generated\EventSettingDomainObjectAbstract
68
{
79
/**
@@ -43,4 +45,17 @@ public function getAddressString(): string
4345

4446
return implode(', ', $filteredAddressParts);
4547
}
48+
49+
public function getAddress(): AddressDTO
50+
{
51+
return new AddressDTO(
52+
venue_name: $this->getLocationDetails()['venue_name'] ?? null,
53+
address_line_1: $this->getLocationDetails()['address_line_1'] ?? null,
54+
address_line_2: $this->getLocationDetails()['address_line_2'] ?? null,
55+
city: $this->getLocationDetails()['city'] ?? null,
56+
state_or_region: $this->getLocationDetails()['state_or_region'] ?? null,
57+
zip_or_postal_code: $this->getLocationDetails()['zip_or_postal_code'] ?? null,
58+
country: $this->getLocationDetails()['country'] ?? null,
59+
);
60+
}
4661
}

backend/app/Mail/Attendee/AttendeeTicketMail.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ public function content(): Content
5050
'event' => $this->event,
5151
'attendee' => $this->attendee,
5252
'eventSettings' => $this->eventSettings,
53+
'organizer' => $this->organizer,
5354
'ticketUrl' => sprintf(
5455
Url::getFrontEndUrlFromConfig(Url::ATTENDEE_TICKET),
5556
$this->event->getId(),

backend/resources/views/emails/orders/attendee-ticket.blade.php

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
@php use HiEvents\Helper\DateHelper; @endphp
12
@php /** @uses /backend/app/Mail/OrderSummary.php */ @endphp
2-
@php /** @var \HiEvents\DomainObjects\OrderDomainObject $order */ @endphp
33
@php /** @var \HiEvents\DomainObjects\EventDomainObject $event */ @endphp
44
@php /** @var \HiEvents\DomainObjects\EventSettingDomainObject $eventSettings */ @endphp
5+
@php /** @var \HiEvents\DomainObjects\OrganizerDomainObject $organizer */ @endphp
6+
@php /** @var \HiEvents\DomainObjects\AttendeeDomainObject $attendee */ @endphp
57
@php /** @var string $ticketUrl */ @endphp
68
@php /** @see \HiEvents\Mail\Attendee\AttendeeTicketMail */ @endphp
79

@@ -22,4 +24,49 @@
2224
Best regards,
2325
<br>
2426
{{config('app.name')}}
27+
28+
<script type="application/ld+json">
29+
{
30+
"@context": "http://schema.org",
31+
"@type": "EventReservation",
32+
"reservationNumber": "{{ $attendee->getPublicId() }}",
33+
"reservationStatus": "http://schema.org/Confirmed",
34+
"underName": {
35+
"@type": "Person",
36+
"name": "{{ $attendee->getFirstName() }} {{ $attendee->getLastName() }}"
37+
},
38+
"reservationFor": {
39+
"@type": "Event",
40+
"name": "{{ $event->getTitle() }}",
41+
"performer": {
42+
"@type": "Organization",
43+
"name": "{{ $organizer->getName() }}",
44+
},
45+
"startDate": "{{ DateHelper::convertFromUTC($event->getStartDate(), $event->getTimezone()) }}",
46+
47+
@if($event->getEndDate())
48+
"endDate": "{{ DateHelper::convertFromUTC($event->getEndDate(), $event->getTimezone()) }}",
49+
@endif
50+
51+
@if ($eventSettings->getLocationDetails())
52+
"location": {
53+
"@type": "Place",
54+
"name": "{{ $eventSettings->getAddress()->venue_name }}",
55+
"address": {
56+
"@type": "PostalAddress",
57+
"streetAddress": "{{ $eventSettings->getAddress()->address_line_1 . ' ' . $eventSettings->getAddress()->address_line_2 }}",
58+
"addressLocality": "{{ $eventSettings->getAddress()->city }}",
59+
"addressRegion": "{{ $eventSettings->getAddress()->state_or_region }}",
60+
"postalCode": "{{ $eventSettings->getAddress()->zip_or_postal_code }}",
61+
"addressCountry": "{{ $eventSettings->getAddress()->country }}"
62+
}
63+
}
64+
},
65+
@endif
66+
67+
"ticketToken": "qrCode:{{ $attendee->getPublicId() }}",
68+
"ticketNumber": "{{ $attendee->getPublicId() }}",
69+
"ticketPrintUrl": "{{ $ticketUrl }}",
70+
}
71+
</script>
2572
</x-mail::message>

0 commit comments

Comments
 (0)