Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
7 / 7
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
PromptPersonalMilestoneResource
100.00% covered (success)
100.00%
7 / 7
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 toArray
100.00% covered (success)
100.00%
7 / 7
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3namespace App\Http\Resources\v2;
4
5use Illuminate\Http\Request;
6use Illuminate\Http\Resources\Json\JsonResource;
7
8/**
9 * Resource for transforming PromptPersonalMilestone models for API responses.
10 *
11 * @property string $_id The milestone ID
12 * @property string $title The milestone title
13 * @property string $prompt The milestone prompt text
14 * @property \Carbon\Carbon|null $created_at
15 * @property \Carbon\Carbon|null $updated_at
16 */
17class PromptPersonalMilestoneResource extends JsonResource
18{
19    /**
20     * Transform the resource into an array.
21     *
22     * @return array<string, mixed>
23     */
24    public function toArray(Request $request): array
25    {
26        return [
27            'id' => (string) $this->_id,
28            'title' => $this->title,
29            'prompt' => $this->prompt,
30            'created_at' => $this->created_at?->timestamp,
31            'updated_at' => $this->updated_at?->timestamp,
32        ];
33    }
34}