QR: add type-to-confirm delete on the QR code page
Deploy Ladill QR Plus / deploy (push) Successful in 59s
Deploy Ladill QR Plus / deploy (push) Successful in 59s
Users asked to delete codes they no longer need. Add a destroy route + controller action (authorized via QrCodePolicy::delete) and a danger-zone delete on the show page behind a confirmation modal that requires typing the code's label — deliberately not a one-click delete since it permanently breaks the printed code and removes its scan history. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
c4e2c75324
commit
46d0ef8825
@@ -279,6 +279,20 @@ class QrCodeController extends Controller
|
||||
return back()->with('success', 'QR code updated.');
|
||||
}
|
||||
|
||||
public function destroy(Request $request, QrCode $qrCode): RedirectResponse
|
||||
{
|
||||
$this->authorize('delete', $qrCode);
|
||||
|
||||
// Remove the code and its scan history. Deletion is gated behind a
|
||||
// type-to-confirm dialog in the UI — this is intentionally permanent.
|
||||
$qrCode->scans()->delete();
|
||||
$qrCode->delete();
|
||||
|
||||
return redirect()
|
||||
->route('user.qr-codes.index')
|
||||
->with('success', 'QR code deleted.');
|
||||
}
|
||||
|
||||
public function stylePreview(Request $request): Response
|
||||
{
|
||||
$validated = $request->validate(array_merge($this->styleRules(), [
|
||||
|
||||
Reference in New Issue
Block a user