created_at ?? null; if ($createdAt instanceof CarbonImmutable) { $immutable = $createdAt; } elseif ($createdAt instanceof CarbonInterface) { $immutable = CarbonImmutable::instance($createdAt); } else { $immutable = CarbonImmutable::parse((string) ($createdAt ?? 'now')); } return new self( id: isset($entry->id) ? (int) $entry->id : null, workspaceId: (int) ($entry->workspace_id ?? 0), fleetNodeId: isset($entry->fleet_node_id) ? (int) $entry->fleet_node_id : null, taskType: (string) ($entry->task_type ?? ''), amount: (int) ($entry->amount ?? 0), balanceAfter: (int) ($entry->balance_after ?? 0), description: isset($entry->description) ? (string) $entry->description : null, createdAt: $immutable, ); } public function toArray(): array { return [ 'id' => $this->id, 'workspace_id' => $this->workspaceId, 'fleet_node_id' => $this->fleetNodeId, 'task_type' => $this->taskType, 'amount' => $this->amount, 'balance_after' => $this->balanceAfter, 'description' => $this->description, 'created_at' => $this->createdAt->toIso8601String(), ]; } }