public function qr($size) { if (!$this->qr_code) { $this->qr_code = md5(md5($this->id) . "!@#\$.Oiad12Adkfjas2@\$55"); $this->save(); } $qr = $this->getPath("c", "qr." . $size); if (!file_exists($qr)) { QrCode::format('png')->size($size)->generate($this->qr_code, $qr); } return $qr; }
public function qrcode(Request $request) { $order = ActivityOrder::findOrfail($request->input('orderId')); $result = $this->initPayOrder($order); if ($this->isResultOK($result)) { $order->paying = 1; $order->save(); $url = $result["code_url"]; return QrCode::format('png')->size(200)->generate($url); } else { return readfile('img/qrcode-failed.png'); } }
function generateQRCode($thc) { $path = base_path('public') . DIRECTORY_SEPARATOR . 'customers' . DIRECTORY_SEPARATOR . 'qrcodes' . DIRECTORY_SEPARATOR . $thc . '.png'; $code = \SimpleSoftwareIO\QrCode\Facades\QrCode::format('png')->size(150)->generate($thc, $path); return $code; }