fix: Correct web.php syntax and use correct QR library

- Fix malformed route on line 84 (missing closing paren and semicolon)
- Replace SimpleSoftwareIO QrCode with chillerlan/php-qrcode (already installed)
- Update QrStickerService to use chillerlan\QRCode\QRCode
- Configure QR options for SVG output with H error correction
This commit is contained in:
twotalesanimation
2026-01-02 20:10:06 +02:00
parent 3040681842
commit e503cd3479
2 changed files with 25 additions and 11 deletions
+22 -9
View File
@@ -4,9 +4,10 @@ namespace App\Services;
use App\Models\Order;
use Barryvdh\DomPDF\Facade\Pdf;
use chillerlan\QRCode\QRCode;
use chillerlan\QRCode\QROptions;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Storage;
use SimpleSoftwareIO\QrCode\Facades\QrCode;
class QrStickerService
{
@@ -56,12 +57,18 @@ class QrStickerService
*/
private function generateSvg(Order $order, string $qrUrl): string
{
$qrCode = QrCode::size(300)
->errorCorrection('H')
->generate($qrUrl);
$options = new QROptions([
'outputType' => QRCode::OUTPUT_MARKUP_SVG,
'eccLevel' => QRCode::ECC_H,
'scale' => 3,
'imageBase64' => false,
]);
$qrCode = new QRCode($options);
$qrSvg = $qrCode->render($qrUrl);
$path = "qr-codes/{$order->uuid}.svg";
Storage::disk('public')->put($path, $qrCode);
Storage::disk('public')->put($path, $qrSvg);
return $path;
}
@@ -76,10 +83,16 @@ class QrStickerService
*/
private function generatePdf(Order $order, string $qrUrl): string
{
// Generate inline QR code as base64 data URL
$qrSvg = QrCode::size(400)
->errorCorrection('H')
->generate($qrUrl);
// Generate inline QR code as SVG
$options = new QROptions([
'outputType' => QRCode::OUTPUT_MARKUP_SVG,
'eccLevel' => QRCode::ECC_H,
'scale' => 4,
'imageBase64' => false,
]);
$qrCode = new QRCode($options);
$qrSvg = $qrCode->render($qrUrl);
// Determine order type and format label
$orderType = $order->type === 'standard'