adrema/app/Pdf/Repository.php

39 lines
733 B
PHP
Raw Normal View History

2021-07-17 15:25:50 +02:00
<?php
namespace App\Pdf;
2021-07-17 19:21:27 +02:00
use App\Member\Member;
2021-07-17 17:13:16 +02:00
use Carbon\Carbon;
2021-07-17 19:21:27 +02:00
use Generator;
2021-07-17 17:13:16 +02:00
2021-07-17 15:25:50 +02:00
abstract class Repository
{
public function number(int $number): string
{
return number_format($number / 100, 2, '.', '');
}
2021-07-17 17:13:16 +02:00
public function getUntil(): Carbon
{
return now()->addWeeks(2);
}
2021-07-17 19:21:27 +02:00
public function createable(Member $member): bool
{
return $this->getPayments($member)->count() !== 0;
}
public function allPayments(): Generator
{
foreach ($this->pages as $page) {
foreach ($page as $member) {
foreach ($this->getPayments($member) as $payment) {
yield $payment;
}
}
}
}
2021-07-17 15:25:50 +02:00
}