-
Notifications
You must be signed in to change notification settings - Fork 64
Expand file tree
/
Copy pathEventDetailsResource.php
More file actions
32 lines (29 loc) · 1.38 KB
/
EventDetailsResource.php
File metadata and controls
32 lines (29 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
namespace App\Http\Resources;
use Illuminate\Http\Resources\Json\JsonResource;
use OpenApi\Attributes as OA;
#[OA\Schema(
title: 'EventDetails',
properties: [
new OA\Property(property: 'id', type: 'integer', example: 39),
new OA\Property(property: 'slug', type: 'string', example: '9_euro_ticket'),
new OA\Property(property: 'totalDistance', description: 'distance travelled in meters', type: 'integer', example: 12345),
new OA\Property(property: 'totalDuration', description: 'duration travelled in minutes', type: 'integer', example: 12345),
new OA\Property(property: 'trainDistance', description: 'Deprecated. Use totalDistance instead.', type: 'integer', example: 12345, deprecated: true),
new OA\Property(property: 'trainDuration', description: 'Deprecated. Use totalDuration instead.', type: 'integer', example: 12345, deprecated: true),
],
)]
class EventDetailsResource extends JsonResource
{
public function toArray($request): array
{
return [
'id' => $this->id,
'slug' => $this->slug,
'totalDistance' => $this->totalDistance,
'totalDuration' => $this->totalDuration,
'trainDistance' => $this->totalDistance, // @deprecated - remove after 2026-09-30
'trainDuration' => $this->totalDuration, // @deprecated - remove after 2026-09-30
];
}
}