Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 26
0.00% covered (danger)
0.00%
0 / 1
CRAP
0.00% covered (danger)
0.00%
0 / 1
CompanyLicenseResource
0.00% covered (danger)
0.00%
0 / 26
0.00% covered (danger)
0.00%
0 / 1
30
0.00% covered (danger)
0.00%
0 / 1
 toArray
0.00% covered (danger)
0.00%
0 / 26
0.00% covered (danger)
0.00%
0 / 1
30
1<?php
2
3namespace App\Http\Resources;
4
5use Illuminate\Http\Request;
6use Illuminate\Http\Resources\Json\JsonResource;
7
8class CompanyLicenseResource extends JsonResource
9{
10    /**
11     * Transform the resource into an array.
12     *
13     * @return array<string, mixed>
14     */
15    public function toArray(Request $request): array
16    {
17        return [
18            [
19                'value' => 'Starter',
20                'label' => 'Starter',
21                'licensesAvailable' => $this->total_starter_license_remaining <= 0 ? 0 : $this->total_starter_license_remaining,
22                'totalLicenses' => $this->total_starter_license_count,
23            ],
24            [
25                'value' => 'Growth',
26                'label' => 'Growth',
27                'licensesAvailable' => $this->total_growth_license_remaining <= 0 ? 0 : $this->total_growth_license_remaining,
28                'totalLicenses' => $this->total_growth_license_count,
29            ],
30            [
31                'value' => 'Sales Pro',
32                'label' => 'Sales Pro',
33                'licensesAvailable' => $this->total_sales_pro_license_remaining <= 0 ? 0 : $this->total_sales_pro_license_remaining,
34                'totalLicenses' => $this->total_sales_pro_license_count,
35            ],
36            [
37                'value' => 'Sales Pro Teams',
38                'label' => 'Sales Pro Teams',
39                'licensesAvailable' => $this->total_sales_pro_teams_license_remaining <= 0 ? 0 : $this->total_sales_pro_teams_license_remaining,
40                'totalLicenses' => $this->total_sales_pro_teams_license_count,
41            ],
42        ];
43    }
44}