diff --git a/src/Models/Event.php b/src/Models/Event.php index 47e1f56..6dfedde 100644 --- a/src/Models/Event.php +++ b/src/Models/Event.php @@ -78,6 +78,13 @@ class Event extends Model */ protected Carbon $startAt; + /** + * The event meetup date. + * + * @var Carbon|null + */ + protected ?Carbon $meetupAt; + /** * The event banner. * @@ -216,6 +223,10 @@ public function __construct(Client $client, array $event) ); $this->startAt = new Carbon($this->getValue('start_at'), 'UTC'); + + $meetupAt = $this->getValue('meetup_at'); + $this->meetupAt = $meetupAt ? new Carbon($meetupAt, 'UTC') : null; + $this->banner = $this->getValue('banner'); $this->map = $this->getValue('map'); $this->description = $this->getValue('description'); @@ -346,6 +357,16 @@ public function getStartAt(): Carbon return $this->startAt; } + /** + * Get the start date of the event. + * + * @return Carbon|null + */ + public function getMeetupAt(): ?Carbon + { + return $this->meetupAt; + } + /** * Get the banner of the event. * diff --git a/tests/Unit/Models/EventTest.php b/tests/Unit/Models/EventTest.php index 3ead81c..593f3d4 100644 --- a/tests/Unit/Models/EventTest.php +++ b/tests/Unit/Models/EventTest.php @@ -106,6 +106,11 @@ public function testItHasAStartDate() $this->assertDate('2023-01-04 14:32:28', $this->event->getStartAt()); } + public function testItHasAMeetupDate() + { + $this->assertDate('2023-01-04 14:02:28', $this->event->getMeetupAt()); + } + public function testItHasABanner() { $this->assertSame('https://static.truckersmp.com/images/event/cover/cover.png', $this->event->getBanner()); diff --git a/tests/Unit/Models/fixtures/event.json b/tests/Unit/Models/fixtures/event.json index c5642d9..90d724e 100644 --- a/tests/Unit/Models/fixtures/event.json +++ b/tests/Unit/Models/fixtures/event.json @@ -21,6 +21,7 @@ "city": "Stuttgart" }, "start_at": "2023-01-04 14:32:28", + "meetup_at": "2023-01-04 14:02:28", "banner": "https://static.truckersmp.com/images/event/cover/cover.png", "map": "https://static.truckersmp.com/images/event/map/map.png", "description": "Description", diff --git a/tests/Unit/Requests/fixtures/event.index.json b/tests/Unit/Requests/fixtures/event.index.json index fe816af..d0c2559 100644 --- a/tests/Unit/Requests/fixtures/event.index.json +++ b/tests/Unit/Requests/fixtures/event.index.json @@ -25,6 +25,7 @@ "city": "Stuttgart" }, "start_at": "2023-01-15 19:00:00", + "meetup_at": "2023-01-15 18:00:00", "banner": "https://static.truckersmp.com/images/event/cover/cover.jpeg", "map": "https://static.truckersmp.com/images/event/map/map.png", "description": "Description", @@ -75,6 +76,7 @@ "city": "Stuttgart" }, "start_at": "2023-01-04 17:00:00", + "meetup_at": "2023-01-04 16:00:00", "banner": "https://static.truckersmp.com/images/event/cover/cover.png", "map": "https://static.truckersmp.com/images/event/map/map.jpeg", "description": "", @@ -127,6 +129,7 @@ "city": "Dover" }, "start_at": "2023-01-07 13:00:00", + "meetup_at": "2023-01-07 12:00:00", "banner": "https://static.truckersmp.com/images/event/cover/cover.jpeg", "map": "https://static.truckersmp.com/images/event/map/map.png", "description": "Description", diff --git a/tests/Unit/Requests/fixtures/event.json b/tests/Unit/Requests/fixtures/event.json index e47048b..8409b23 100644 --- a/tests/Unit/Requests/fixtures/event.json +++ b/tests/Unit/Requests/fixtures/event.json @@ -23,6 +23,7 @@ "city": "Stuttgart" }, "start_at": "2023-01-04 14:32:28", + "meetup_at": "2023-01-04 14:02:28", "banner": "https://static.truckersmp.com/images/event/cover/cover.png", "map": "https://static.truckersmp.com/images/event/map/map.png", "description": "Description", diff --git a/tests/Unit/Requests/fixtures/event.user.json b/tests/Unit/Requests/fixtures/event.user.json index f5d9c85..525b084 100644 --- a/tests/Unit/Requests/fixtures/event.user.json +++ b/tests/Unit/Requests/fixtures/event.user.json @@ -24,6 +24,7 @@ "city": "Verona" }, "start_at": "2023-02-19 18:30:00", + "meetup_at": "2023-02-19 18:00:00", "banner": "https://static.truckersmp.com/images/event/cover/cover.png", "map": "https://static.truckersmp.com/images/event/map/map.png", "description": "Description",