#22 - wip
This commit is contained in:
@@ -20,8 +20,8 @@ class VacationRequestResource extends JsonResource
|
||||
"state" => $this->state->label(),
|
||||
"from" => $this->from->toDisplayString(),
|
||||
"to" => $this->to->toDisplayString(),
|
||||
"estimatedDays" => $this->estimated_days,
|
||||
"comment" => $this->comment,
|
||||
"days" => VacationResource::collection($this->vacations),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
21
app/Infrastructure/Http/Resources/VacationResource.php
Normal file
21
app/Infrastructure/Http/Resources/VacationResource.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Toby\Infrastructure\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class VacationResource extends JsonResource
|
||||
{
|
||||
public static $wrap = null;
|
||||
|
||||
public function toArray($request): array
|
||||
{
|
||||
return [
|
||||
"id" => $this->id,
|
||||
"displayDate" => $this->date->toDisplayString(),
|
||||
"date" => $this->date->toDateString(),
|
||||
];
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user