<?php

namespace App\Http\Controllers\Admin;

use Illuminate\Routing\Controller as BaseController;
use Illuminate\Http\Request;
use SimpleSoftwareIO\QrCode\Facades\QrCode;

class QrController extends BaseController
{
    public function png(Request $request)
    {
        $data = (string) $request->query('data', '');
        if ($data === '') {
            return response('missing data', 400);
        }
        $png = QrCode::format('png')->size(300)->generate($data);
        return response($png, 200, ['Content-Type' => 'image/png']);
    }
}

