minor fixes

This commit is contained in:
David Bomba 2024-06-22 20:58:17 +10:00
parent 540dd2f43e
commit 18e0ced89c

View File

@ -122,7 +122,12 @@ class PaymentController extends Controller
/** @var \App\Models\CompanyGateway $gateway **/ /** @var \App\Models\CompanyGateway $gateway **/
$gateway = CompanyGateway::findOrFail($request->input('company_gateway_id')); $gateway = CompanyGateway::findOrFail($request->input('company_gateway_id'));
$payment_hash = PaymentHash::where('hash', $request->payment_hash)->firstOrFail(); $payment_hash = PaymentHash::where('hash', $request->payment_hash)->firstOrFail();
$invoice = Invoice::with('client')->find($payment_hash->fee_invoice_id);
if($payment_hash)
$invoice = $payment_hash->fee_invoice;
else
$invoice = Invoice::with('client')->where('id',$payment_hash->fee_invoice_id)->orderBy('id','desc');
$client = $invoice ? $invoice->client : auth()->guard('contact')->user()->client; $client = $invoice ? $invoice->client : auth()->guard('contact')->user()->client;
// 09-07-2022 catch duplicate responses for invoices that already paid here. // 09-07-2022 catch duplicate responses for invoices that already paid here.