Add delete for Mini payment QRs.
Deploy Ladill Mini / deploy (push) Successful in 33s

Vendors can remove a payment QR from the show page; stored images are cleaned up and the short link stops resolving.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
isaacclad
2026-06-07 20:49:15 +00:00
co-authored by Cursor
parent 327cf65e6c
commit f52e3e882e
5 changed files with 44 additions and 0 deletions
@@ -101,6 +101,17 @@ class PaymentQrController extends Controller
return back()->with('success', 'Payment QR updated.');
}
public function destroy(QrCode $paymentQr): RedirectResponse
{
$this->authorizePaymentQr($paymentQr);
$this->manager->delete($paymentQr);
return redirect()
->route('mini.payment-qrs.index')
->with('success', 'Payment QR deleted.');
}
public function preview(QrCode $paymentQr): Response
{
$this->authorizePaymentQr($paymentQr);
+16
View File
@@ -536,4 +536,20 @@ class QrCodeManagerService
throw new RuntimeException('Could not generate a unique QR short code.');
}
public function delete(QrCode $qrCode): void
{
$paths = array_filter([$qrCode->png_path, $qrCode->svg_path]);
$logoPath = $qrCode->content()['logo_path'] ?? null;
if (is_string($logoPath) && $logoPath !== '') {
$paths[] = $logoPath;
}
foreach ($paths as $path) {
Storage::disk('qr')->delete($path);
}
$qrCode->delete();
}
}