first commit
This commit is contained in:
33
app/Core/Service/QRCodeService.php
Normal file
33
app/Core/Service/QRCodeService.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
namespace App\Core\Service;
|
||||
|
||||
/*use Illuminate\Support\Facades\Log;
|
||||
use SimpleSoftwareIO\QrCode\Generator;
|
||||
use Exception;
|
||||
|
||||
class QRCodeService{
|
||||
|
||||
private $generator;
|
||||
|
||||
public function __construct(Generator $generator)
|
||||
{
|
||||
$this->generator = $generator;
|
||||
}
|
||||
|
||||
public function generate($url, $size){
|
||||
|
||||
$message = "Error occurred while generating qr code";
|
||||
$response = ['status' => false, 'message' => $message, 'data' => NULL ];
|
||||
|
||||
try {
|
||||
$qrCode = $this->generator->size($size)->format('png')->generate(url($url));
|
||||
$response = ['status' => true, 'message' => '', 'data' => $qrCode ];
|
||||
}catch (Exception $e){
|
||||
Log::error($message);
|
||||
}
|
||||
|
||||
return $response;
|
||||
|
||||
}
|
||||
|
||||
}*/
|
||||
Reference in New Issue
Block a user