*/ public Collection $members; public function mount(): void { $this->members = Member::where(function ($query) { $time = now()->subYears(5)->endOfYear(); return $query ->orWhere(fn ($query) => $query->whereNull('ps_at')->whereNull('more_ps_at')) ->orWhere(fn ($query) => $query->whereNull('ps_at')->where('more_ps_at', '<=', $time)) ->orWhere(fn ($query) => $query->where('ps_at', '<=', $time)->whereNull('more_ps_at')) ->orWhere(fn ($query) => $query->where('ps_at', '>=', $time)->where('more_ps_at', '<=', $time)); }) ->whereCurrentGroup() ->orderByRaw('lastname, firstname') ->whereHas('memberships', fn ($builder) => $builder->isLeader()->active()) ->get(); } public function title(): string { return 'Ausstehende Präventionsschulungen'; } public function render(): string { return <<<'HTML'
@foreach ($members as $member)
{{ $member->fullname }}
@endforeach
HTML; } }