Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
10 / 10
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
TransferTaskProductResource
100.00% covered (success)
100.00%
10 / 10
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 toArray
100.00% covered (success)
100.00%
10 / 10
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3namespace Domain\TransferTask\Resources;
4
5use Domain\Address\Resources\AddressResource;
6use Domain\Product\Resources\ProductResource;
7use Illuminate\Http\Request;
8use Illuminate\Http\Resources\Json\JsonResource;
9
10/**
11 * @property int $id
12 * @property float $suggestion_amount
13 * @property String $created_at
14 * @property String $updated_at
15 */
16class TransferTaskProductResource extends JsonResource
17{
18
19    public function toArray(Request $request): array
20    {
21        return [
22            'id' => $this->id,
23            'Transfer_task' => TransferTaskResource::make($this->whenLoaded('transfer_task')),
24            'product' => ProductResource::make($this->whenLoaded('product')),
25            'suggestion_origin' => AddressResource::make($this->whenLoaded('suggestionOrigin')),
26            'suggestion_destination' => AddressResource::make($this->whenLoaded('suggestionDestination')),
27            'suggestion_amount' => $this->suggestion_amount,
28            'created_at' => (string)$this->created_at,
29            'updated_at' => (string)$this->updated_at,
30        ];
31    }
32}