get(); return [ 'data' => MemberResource::collection(Member::select('*') ->filter($filter)->search($request->query('search', null)) ->with('billKind')->with('payments.subscription')->with('memberships')->with('courses')->with('subscription')->with('leaderMemberships')->with('ageGroupMemberships') ->withPendingPayment() ->orderByRaw('lastname, firstname') ->paginate(15) ), 'filterActivities' => Activity::where('is_filterable', true)->pluck('name', 'id'), 'filterSubactivities' => Subactivity::where('is_filterable', true)->pluck('name', 'id'), 'toolbar' => [['href' => route('member.index'), 'label' => 'Zurück', 'color' => 'primary', 'icon' => 'plus']], 'paymentDefaults' => ['nr' => date('Y')], 'subscriptions' => Subscription::pluck('name', 'id'), 'statuses' => Status::pluck('name', 'id'), 'regions' => Region::forSelect(), 'activities' => $activities->pluck('name', 'id'), 'courses' => Course::pluck('name', 'id'), 'subactivities' => $activities->map(function (Activity $activity) { return ['subactivities' => $activity->subactivities->pluck('name', 'id'), 'id' => $activity->id]; })->pluck('subactivities', 'id'), ]; } }