Files
mykopkb-be/Modules/Investment/Transformers/ProfileInvestmentLimitResource.php

28 lines
949 B
PHP

<?php
namespace Modules\Investment\Transformers;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
class ProfileInvestmentLimitResource extends JsonResource
{
public function toArray(Request $request): array
{
return [
'id' => $this->id,
'profile_id' => $this->profile_id,
'investment_type_id' => $this->investment_type_id,
'max_investment_amount' => $this->max_investment_amount,
'max_transaction_amount' => $this->max_transaction_amount,
'investment_type' => $this->whenLoaded('investmentType', fn () => [
'id' => $this->investmentType->id,
'code' => $this->investmentType->code,
'name' => $this->investmentType->name,
]),
'created_at' => $this->created_at?->toISOString(),
'updated_at' => $this->updated_at?->toISOString(),
];
}
}