Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
45 / 45
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
ClientSummaryResource
100.00% covered (success)
100.00%
45 / 45
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 toArray
100.00% covered (success)
100.00%
45 / 45
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3namespace App\Http\Resources;
4
5use Illuminate\Http\Request;
6use Illuminate\Http\Resources\Json\JsonResource;
7
8class ClientSummaryResource extends JsonResource
9{
10    public function toArray(Request $request): array
11    {
12        return [
13            'id' => $this->id,
14            'client_type_id' => $this->client_type_id,
15            'client_type' => $this->clientType?->name,
16            'company_name' => $this->company_name,
17            'fiscal_id' => $this->fiscal_id,
18            'address' => $this->address,
19            'postal_code' => $this->postal_code,
20            'city' => $this->city,
21            'province' => $this->province,
22            'scope' => $this->scope,
23            'region' => $this->region,
24            'annual_maintenance' => $this->annual_maintenance,
25            'annual_maint_start_date' => $this->annual_maint_start_date,
26            'annual_maint_frequency' => $this->annual_maint_frequency,
27            'quarterly_maintenance' => $this->quarterly_maintenance,
28            'quarterly_maint_start_date' => $this->quarterly_maint_start_date,
29            'quarterly_maint_frequency' => $this->quarterly_maint_frequency,
30            'contract_end_date' => $this->contract_end_date,
31            'last_work_date' => $this->last_work_date,
32            'fire_suppression' => $this->fire_suppression,
33            'fire_detection' => $this->fire_detection,
34            'water' => $this->water,
35            'relationship_status' => $this->relationship_status,
36            'termination_date' => $this->termination_date,
37            'non_client_contract_end_date' => $this->non_client_contract_end_date,
38            'payment_method' => $this->payment_method,
39            'client_annual_billing' => $this->client_annual_billing,
40            'fire_current_billing' => $this->fire_current_billing,
41            'fire_billing_potential' => $this->fire_billing_potential,
42            'contact_name' => $this->contact_name,
43            'contact_phone' => $this->contact_phone,
44            'contact_email' => $this->contact_email,
45            'notes' => $this->notes,
46            'gestiona_client_code' => $this->gestiona_client_code,
47            'associated_billing_client' => $this->associated_billing_client,
48            'allows_communications' => $this->allows_communications,
49            'last_visit_date' => $this->last_visit_date,
50            'created_at' => $this->created_at,
51            'updated_at' => $this->updated_at,
52            'segment' => new SegmentResource($this->whenLoaded('segment')),
53            'strategy_type' => new StrategyTypeResource($this->whenLoaded('strategyType')),
54            'administrator' => new AdministratorResource($this->whenLoaded('administrator')),
55            'commercials' => CommercialResource::collection($this->whenLoaded('commercials')),
56        ];
57    }
58}