Files
mykopkb-be/Modules/Investment/Transformers/InvestmentLimitProfileResource.php
T

23 lines
754 B
PHP

<?php
namespace Modules\Investment\Transformers;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
class InvestmentLimitProfileResource extends JsonResource
{
public function toArray(Request $request): array
{
return [
'id' => $this->id,
'name' => $this->name,
'description' => $this->description,
'profile_limits_count' => $this->when(isset($this->profile_limits_count), $this->profile_limits_count),
'profile_limits' => ProfileInvestmentLimitResource::collection($this->whenLoaded('profileLimits')),
'created_at' => $this->created_at?->toISOString(),
'updated_at' => $this->updated_at?->toISOString(),
];
}
}