Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
9 / 9 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| ResourceCenterResource | |
100.00% |
9 / 9 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
| toArray | |
100.00% |
9 / 9 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace Domain\CostCenter\Resources; |
| 4 | |
| 5 | use Domain\Integration\Resources\IntegrationResource; |
| 6 | |
| 7 | use Illuminate\Http\Request; |
| 8 | use Illuminate\Http\Resources\Json\JsonResource; |
| 9 | |
| 10 | /** |
| 11 | * @property integer $id |
| 12 | * @property string $description |
| 13 | * @property string $acronym |
| 14 | * @property IntegrationResource $integration |
| 15 | * @property string $created_at |
| 16 | * @property string $updated_at |
| 17 | */ |
| 18 | class ResourceCenterResource extends JsonResource |
| 19 | { |
| 20 | |
| 21 | public function toArray(Request $request): array |
| 22 | { |
| 23 | return [ |
| 24 | 'id' => $this->id, |
| 25 | 'description' => $this->description, |
| 26 | 'acronym' => $this->acronym, |
| 27 | 'integration' => IntegrationResource::make($this->whenLoaded('integration')), |
| 28 | 'cost_center' => CostCenterResource::make($this->whenLoaded('costCenter')), |
| 29 | 'created_at' => $this->created_at, |
| 30 | 'updated_at' => $this->updated_at |
| 31 | ]; |
| 32 | } |
| 33 | } |