FranchiseeContractTaxHistoryResource.php 1.0 KB

1234567891011121314151617181920212223242526
  1. <?php
  2. namespace App\Http\Resources;
  3. use Illuminate\Http\Request;
  4. use Illuminate\Http\Resources\Json\JsonResource;
  5. class FranchiseeContractTaxHistoryResource extends JsonResource
  6. {
  7. public function toArray(Request $request): array
  8. {
  9. return [
  10. 'id' => $this->id,
  11. 'municipality_size_id' => $this->municipality_size_id,
  12. 'municipality_size' => $this->whenLoaded('municipalitySize', fn() => [
  13. 'id' => $this->municipalitySize?->id,
  14. 'description' => $this->municipalitySize?->description,
  15. ]),
  16. 'tbr_fixed_value' => $this->tbr_fixed_value,
  17. 'tbr_fixed_value_percentage' => $this->tbr_fixed_value_percentage,
  18. 'marketing_fund_percentage' => $this->marketing_fund_percentage,
  19. 'maintance_tax_percentage' => $this->maintance_tax_percentage,
  20. 'created_at' => $this->created_at?->format('Y-m-d H:i:s'),
  21. ];
  22. }
  23. }