|
|
@@ -17,9 +17,14 @@ class FranchiseeContractResource extends JsonResource
|
|
|
*/
|
|
|
public function toArray(Request $request): array
|
|
|
{
|
|
|
+ $contractMonthCurrent = $this->start_date
|
|
|
+ ? (int) $this->start_date->diffInMonths(now()) + 1
|
|
|
+ : null;
|
|
|
+
|
|
|
return [
|
|
|
'id' => $this->id,
|
|
|
'unit_id' => $this->unit_id,
|
|
|
+ 'unit_name' => $this->whenLoaded('unit', fn() => $this->unit->fantasy_name),
|
|
|
'protocol' => $this->protocol,
|
|
|
'start_date' => $this->start_date?->format('Y-m-d'),
|
|
|
'end_date' => $this->end_date?->format('Y-m-d'),
|
|
|
@@ -30,6 +35,7 @@ public function toArray(Request $request): array
|
|
|
'maintance_tax_percentage' => $this->maintance_tax_percentage,
|
|
|
'inhabitant_classification_id' => $this->inhabitant_classification_id,
|
|
|
'validity_months' => $this->validity_months,
|
|
|
+ 'contract_month_current' => $contractMonthCurrent,
|
|
|
'created_at' => Carbon::parse($this->created_at)->format('Y-m-d H:i:s'),
|
|
|
'updated_at' => Carbon::parse($this->updated_at)->format('Y-m-d H:i:s'),
|
|
|
];
|