45 lines
1.0 KiB
PHP
45 lines
1.0 KiB
PHP
|
<?php
|
||
|
|
||
|
namespace Modules\Prevention;
|
||
|
|
||
|
use Modules\Dashboard\Block;
|
||
|
use App\Member\Member;
|
||
|
use Illuminate\Database\Eloquent\Builder;
|
||
|
|
||
|
class EfzPendingBlock extends Block
|
||
|
{
|
||
|
/**
|
||
|
* @return Builder<Member>
|
||
|
*/
|
||
|
public function query(): Builder
|
||
|
{
|
||
|
return Member::where(function ($query) {
|
||
|
return $query->where('efz', '<=', now()->subYears(5)->endOfYear())
|
||
|
->orWhereNull('efz');
|
||
|
})
|
||
|
->whereCurrentGroup()
|
||
|
->orderByRaw('lastname, firstname')
|
||
|
->whereHas('memberships', fn ($builder) => $builder->isLeader()->active());
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @return array{members: array<int, string>}
|
||
|
*/
|
||
|
public function data(): array
|
||
|
{
|
||
|
return [
|
||
|
'members' => $this->query()->get()->map(fn ($member) => $member->fullname)->toArray(),
|
||
|
];
|
||
|
}
|
||
|
|
||
|
public function title(): string
|
||
|
{
|
||
|
return 'Ausstehende Führungszeugnisse';
|
||
|
}
|
||
|
|
||
|
public function render(): string
|
||
|
{
|
||
|
return '<div></div>';
|
||
|
}
|
||
|
}
|