i defined created at format in baseModel like this:
protected function serializeDate(DateTimeInterface $date): string
{
return Carbon::instance($date)->toIso8601String();
}
but when i use api Resource, changed created_at format
this is api resource:
public function toArray($request)
{
return [
'id' => $this->id,
'last_status' => $this->lastStatus->status,
'terminal' => [
'provider' => $this->terminal_provider,
'psp' => $this->terminal_psp,
],
'account' => [
'iban' => $this->account_iban,
],
'count' => $this->count,
'amount_settle' => $this->amount_settle,
'amount_wage' => $this->amount_settle,
'created_at' => $this->created_at,
'statuses' => AggregateStatusResource::collection($this->whenLoaded('statuses')),
'shaparak_files' => ShaparakFileResource::collection($this->whenLoaded('shaparakFiles')),
];
}
whay change format for all of api resources