This commit is contained in:
Benjamin Beganović 2021-09-16 14:21:29 +02:00
parent 7be7d2a9da
commit dd7edcff41

View File

@ -21,9 +21,9 @@ use Symfony\Component\HttpFoundation\StreamedResponse;
class StatementController extends Controller class StatementController extends Controller
{ {
/** /**
* Show the statement in the client portal. * Show the statement in the client portal.
* *
* @return View * @return View
*/ */
public function index(): View public function index(): View
{ {
@ -31,17 +31,17 @@ class StatementController extends Controller
} }
/** /**
* Show the raw stream of statement PDF. * Show the raw stream of the PDF.
* *
* @param ShowStatementRequest $request * @param ShowStatementRequest $request
* @return StreamedResponse|JsonResponse * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\Routing\ResponseFactory|JsonResponse|\Illuminate\Http\Response|StreamedResponse
*/ */
public function raw(ShowStatementRequest $request) public function raw(ShowStatementRequest $request)
{ {
$pdf = $request->client()->service()->statement( $pdf = $request->client()->service()->statement(
$request->only(['start_date', 'end_date', 'show_payments_table', 'show_aging_table']) $request->only(['start_date', 'end_date', 'show_payments_table', 'show_aging_table'])
); );
if ($pdf && $request->query('download')) { if ($pdf && $request->query('download')) {
return response()->streamDownload(function () use ($pdf) { return response()->streamDownload(function () use ($pdf) {
echo $pdf; echo $pdf;