Files
InvoiceShelf/app/Http/Controllers/V1/Customer/PaymentPdfController.php
2024-01-29 04:46:01 -06:00

29 lines
713 B
PHP

<?php
namespace InvoiceShelf\Http\Controllers\V1\Customer;
use Illuminate\Http\Request;
use InvoiceShelf\Http\Controllers\Controller;
use InvoiceShelf\Http\Resources\PaymentResource;
use InvoiceShelf\Models\EmailLog;
use InvoiceShelf\Models\Payment;
class PaymentPdfController extends Controller
{
public function getPdf(EmailLog $emailLog, Request $request)
{
if (! $emailLog->isExpired()) {
return $emailLog->mailable->getGeneratedPDFOrStream('payment');
}
abort(403, 'Link Expired.');
}
public function getPayment(EmailLog $emailLog)
{
$payment = Payment::find($emailLog->mailable_id);
return new PaymentResource($payment);
}
}