fix: QrCode relation bug and Endroid create() error
This commit is contained in:
@@ -95,6 +95,7 @@ class StorePortalController extends ApiController
|
||||
]);
|
||||
|
||||
if (!$request->household_id && !$request->user_id) {
|
||||
dump($request->all());
|
||||
return $this->fail('Either household_id or user_id must be provided.', null, 422);
|
||||
}
|
||||
|
||||
@@ -121,14 +122,15 @@ class StorePortalController extends ApiController
|
||||
->get();
|
||||
|
||||
$qrData = $codes->map(function ($code) {
|
||||
$qr = \Endroid\QrCode\QrCode::create($code->serial)
|
||||
->setSize(300)
|
||||
->setMargin(10);
|
||||
$writer = new PngWriter;
|
||||
$qr = \Endroid\QrCode\Builder\Builder::create()
|
||||
->data($code->serial)
|
||||
->size(300)
|
||||
->margin(10)
|
||||
->build();
|
||||
|
||||
return [
|
||||
'serial' => $code->serial,
|
||||
'qr_base64' => base64_encode($writer->write($qr)->getString()),
|
||||
'qr_base64' => base64_encode($qr->getString()),
|
||||
];
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user