Added Client case person address to segment tables and exports

This commit is contained in:
Simon Pocrnjič
2026-01-05 19:41:39 +01:00
parent 8031501d25
commit 2ad24216ae
4 changed files with 25 additions and 3 deletions
+7 -2
View File
@@ -64,6 +64,12 @@ public function show(Segment $segment)
->withQueryString();
$contracts = $this->hydrateClientShortcut($contracts);
// Hide addresses array since we're using the singular address relationship
$contracts->getCollection()->each(function ($contract) {
$contract->clientCase?->person?->makeHidden('addresses');
$contract->clientCase?->client?->person?->makeHidden('addresses');
});
$clients = Client::query()
->whereHas('clientCases.contracts.segments', function ($q) use ($segment) {
@@ -191,8 +197,7 @@ private function buildContractsQuery(Segment $segment, ?string $search, ?string
->where('contract_segment.active', '=', 1);
})
->with([
'clientCase.person',
'clientCase.client.person',
'clientCase.person.address',
'type',
'account',
])