44 lines
979 B
PHP
44 lines
979 B
PHP
|
<?php
|
||
|
|
||
|
namespace App\Efz;
|
||
|
|
||
|
use App\Home\Blocks\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');
|
||
|
})
|
||
|
->orderByRaw('lastname, firstname')
|
||
|
->whereHas('memberships', fn ($builder) => $builder->isLeader());
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @return array{member: array<int, string>}
|
||
|
*/
|
||
|
public function data(): array
|
||
|
{
|
||
|
return [
|
||
|
'members' => $this->query()->get()->map(fn ($member) => $member->fullname)->toArray(),
|
||
|
];
|
||
|
}
|
||
|
|
||
|
public function component(): string
|
||
|
{
|
||
|
return 'efz-pending';
|
||
|
}
|
||
|
|
||
|
public function title(): string
|
||
|
{
|
||
|
return 'Ausstehende Führungszeugnisse';
|
||
|
}
|
||
|
}
|