27 lines
622 B
PHP
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,
|
|
];
|
|
}
|
|
}
|