Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
8 / 8
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
PromptLanguageResource
100.00% covered (success)
100.00%
8 / 8
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 toArray
100.00% covered (success)
100.00%
8 / 8
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 PromptLanguage models for API responses.
10 *
11 * @property string $_id The prompt language ID
12 * @property string $title The language title (e.g., "English", "Spanish")
13 * @property string $value The language code (e.g., "en", "es")
14 * @property string $prompt The language prompt text
15 * @property \Carbon\Carbon|null $created_at
16 * @property \Carbon\Carbon|null $updated_at
17 */
18class PromptLanguageResource extends JsonResource
19{
20    /**
21     * Transform the resource into an array.
22     *
23     * @return array<string, mixed>
24     */
25    public function toArray(Request $request): array
26    {
27        return [
28            'id' => (string) $this->_id,
29            'title' => $this->title,
30            'value' => $this->value,
31            'prompt' => $this->prompt,
32            'created_at' => $this->created_at?->timestamp,
33            'updated_at' => $this->updated_at?->timestamp,
34        ];
35    }
36}