Add lazy loading to Contribution MemberData

This commit is contained in:
philipp lang 2025-03-28 16:06:14 +01:00
parent 6806e54209
commit c433abbbb4
1 changed files with 1 additions and 1 deletions
app/Contribution/Data

View File

@ -29,7 +29,7 @@ class MemberData extends Data
*/
public static function fromModels(array $ids): Collection
{
return Member::whereIn('id', $ids)->orderByRaw('lastname, firstname')->get()->map(fn ($member) => self::factory()->withoutMagicalCreation()->from([
return Member::with('leaderMemberships', 'gender')->whereIn('id', $ids)->orderByRaw('lastname, firstname')->get()->map(fn ($member) => self::factory()->withoutMagicalCreation()->from([
...$member->toArray(),
'birthday' => $member->birthday->toAtomString(),
'isLeader' => $member->isLeader(),