25 lines
777 B
PHP
25 lines
777 B
PHP
<?php
|
|
|
|
namespace App\Domains\Event\Resources;
|
|
|
|
use App\Domains\Event\Models\EventDateChange;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
/** @mixin EventDateChange */
|
|
class EventDateChangeResource extends JsonResource
|
|
{
|
|
/** @return array<string, mixed> */
|
|
public function toArray(Request $request): array
|
|
{
|
|
return [
|
|
'type' => $this->change_type->value,
|
|
'source_event_date_id' => $this->source_event_date_id,
|
|
'destination_event_date_id' => $this->destination_event_date_id,
|
|
'previous_date' => $this->previous_date->format('Y-m-d'),
|
|
'new_date' => $this->new_date?->format('Y-m-d'),
|
|
'occurred_at' => $this->created_at->toISOString(),
|
|
];
|
|
}
|
|
}
|