actually this code is working but I want to know if there is a better way to do it, because I’m learning laravel 11.
If this is not the place to make this question can somebody tell me where can I ask the question?
public function generateQR(Request $request) {
$qr = $request->get('qr');
$pass = $request->get('pass');
do {
$code = $this->generateRandomString();
$qrcode = Qrcode::find($code);
} while($qrcode != null);
$qrcode = new Qrcode();
$qrcode->input = $qr;
$qrcode->code = $code;
$qrcode->pass = $pass;
$qrcode->save();
return $qr;
}
Thank’s for answers!
I expect to reduce code for learning.
New contributor
Dozom is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1