toby/app/Infrastructure/Http/Resources/HolidayResource.php
2022-04-29 11:28:06 +02:00

25 lines
581 B
PHP

<?php
declare(strict_types=1);
namespace Toby\Infrastructure\Http\Resources;
use Illuminate\Http\Resources\Json\JsonResource;
class HolidayResource extends JsonResource
{
public static $wrap = null;
public function toArray($request): array
{
return [
"id" => $this->id,
"name" => $this->name,
"date" => $this->date->toDateString(),
"isPast" => $this->date->endOfDay()->isPast(),
"displayDate" => $this->date->toDisplayString(),
"dayOfWeek" => $this->date->dayName,
];
}
}