Files
ticcat/app/Http/Resources/ToDoResource.php
Romulus21 a172cdeb37 add test
2024-04-01 20:16:04 +02:00

27 lines
622 B
PHP

<?php
namespace App\Http\Resources;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
class ToDoResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @return array<string, mixed>
*/
public function toArray(Request $request): array
{
return [
'id' => $this->id,
'user_id' => $this->user_id,
'name' => $this->name,
'description' => $this->description,
'checked' => $this->checked?->format('Y-m-d H:i:s'),
'duration' => $this->duration,
];
}
}