Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 11 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
| ReadingLogResource | |
0.00% |
0 / 11 |
|
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
| toArray | |
0.00% |
0 / 11 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace Domain\ReadingLog\Resources; |
| 4 | |
| 5 | use Domain\ReadingLog\Enums\ReadingLogFormatEnum; |
| 6 | use Domain\ReadingLog\Enums\ReadingLogTypeEnum; |
| 7 | use Domain\Transferable\Resources\TransferableResource; |
| 8 | use Illuminate\Http\Request; |
| 9 | use Illuminate\Http\Resources\Json\JsonResource; |
| 10 | |
| 11 | /** |
| 12 | * @property int $id |
| 13 | * @property ReadingLogFormatEnum $format |
| 14 | * @property ReadingLogTypeEnum $type |
| 15 | * @property string $data |
| 16 | * @property string $created_at |
| 17 | * @property string $updated_at |
| 18 | * @property int $originable_id |
| 19 | * @property string $originable_type |
| 20 | * @property bool $is_valid |
| 21 | */ |
| 22 | class ReadingLogResource extends JsonResource |
| 23 | { |
| 24 | public function toArray(Request $request): array |
| 25 | { |
| 26 | return [ |
| 27 | 'id' => $this->id, |
| 28 | 'type' => $this->type->value, |
| 29 | 'format' => $this->format->value, |
| 30 | 'originable_type' => $this->originable_type, |
| 31 | 'originable_id' => $this->originable_id, |
| 32 | 'data' => $this->data, |
| 33 | 'is_valid' => $this->is_valid, |
| 34 | 'created_at' => (string)$this->created_at, |
| 35 | 'updated_at' => (string)$this->updated_at, |
| 36 | ]; |
| 37 | } |
| 38 | } |