back(); } public static function generateQr($id, $type) { // type is 'auto_' or 'estate_' $url = url(($type === 'auto_' ? 'auto' : 'estate') . '/show/' . $id); $dir = 'public/attachments/' . $type . $id; Storage::makeDirectory($dir); $qr = QrCode::format('png')->size(200)->generate($url); Storage::put($dir . '/qr.png', $qr); } }