2021-07-17 16:57:37 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Payment;
|
|
|
|
|
|
|
|
use App\Member\Member;
|
|
|
|
use App\Pdf\PdfRepositoryFactory;
|
|
|
|
use Illuminate\Support\Collection;
|
|
|
|
|
|
|
|
class ActionFactory
|
|
|
|
{
|
|
|
|
|
|
|
|
public function forMember(Member $member): Collection
|
|
|
|
{
|
|
|
|
return app(PdfRepositoryFactory::class)->getTypes()->map(function(string $repo) use ($member) {
|
|
|
|
$repo = app($repo);
|
|
|
|
|
|
|
|
return [
|
|
|
|
'href' => route('member.singlepdf', ['member' => $member, 'type' => get_class($repo)]),
|
|
|
|
'label' => $repo->linkLabel(),
|
|
|
|
'disabled' => !$repo->createable($member),
|
|
|
|
];
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2021-07-17 18:46:02 +02:00
|
|
|
public function allLinks(): Collection
|
|
|
|
{
|
|
|
|
return app(PdfRepositoryFactory::class)->getTypes()->map(function(string $repo) {
|
|
|
|
$repo = app($repo);
|
|
|
|
|
|
|
|
return [
|
|
|
|
'href' => route('sendpayment.pdf', ['type' => get_class($repo)]),
|
|
|
|
'label' => $repo->allLabel(),
|
|
|
|
];
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2021-07-17 16:57:37 +02:00
|
|
|
}
|