adrema/app/Pdf/MemberPdfController.php

25 lines
604 B
PHP
Raw Normal View History

2021-07-15 21:17:48 +02:00
<?php
namespace App\Pdf;
use App\Http\Controllers\Controller;
use App\Member\Member;
2022-02-12 16:44:43 +01:00
use Illuminate\Contracts\Support\Responsable;
2021-07-15 21:17:48 +02:00
use Illuminate\Http\Request;
2022-02-12 01:25:22 +01:00
use Illuminate\Http\Response;
2021-07-15 21:17:48 +02:00
class MemberPdfController extends Controller
{
2022-02-12 16:44:43 +01:00
/**
* @return Response|Responsable
*/
2022-02-12 01:25:22 +01:00
public function __invoke(Request $request, Member $member)
2021-07-15 21:17:48 +02:00
{
$repo = app(PdfRepositoryFactory::class)->fromSingleRequest($request->type, $member);
2022-03-11 20:19:17 +01:00
return null === $repo
2021-07-15 21:17:48 +02:00
? response()->noContent()
2021-07-16 00:12:19 +02:00
: app(PdfGenerator::class)->setRepository($repo)->render();
2021-07-15 21:17:48 +02:00
}
}