mirror of
https://github.com/Bubka/2FAuth.git
synced 2025-03-27 06:46:45 +01:00
Bind QrCodeService to the Service Container
This commit is contained in:
parent
9bf165895f
commit
14609dec95
@ -4,7 +4,6 @@
|
||||
|
||||
use App\Models\TwoFAccount;
|
||||
use App\Services\QrCodeService;
|
||||
use App\Services\TwoFAccountService;
|
||||
use App\Api\v1\Requests\QrCodeDecodeRequest;
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
@ -16,23 +15,16 @@ class QrCodeController extends Controller
|
||||
*/
|
||||
protected $qrcodeService;
|
||||
|
||||
/**
|
||||
* The TwoFAccount Service instance.
|
||||
*/
|
||||
protected $twofaccountService;
|
||||
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @param \App\Services\QrCodeService $qrcodeService
|
||||
* @param \App\Services\TwoFAccountService $twofaccountService
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(QrCodeService $qrcodeService, TwoFAccountService $twofaccountService)
|
||||
public function __construct(QrCodeService $qrcodeService)
|
||||
{
|
||||
$this->qrcodeService = $qrcodeService;
|
||||
$this->twofaccountService = $twofaccountService;
|
||||
}
|
||||
|
||||
|
||||
|
@ -3,6 +3,7 @@
|
||||
namespace App\Providers;
|
||||
|
||||
use App\Services\LogoService;
|
||||
use App\Services\QrCodeService;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Illuminate\Contracts\Support\DeferrableProvider;
|
||||
|
||||
@ -18,6 +19,10 @@ public function register()
|
||||
$this->app->singleton(LogoService::class, function ($app) {
|
||||
return new LogoService();
|
||||
});
|
||||
|
||||
$this->app->singleton(QrCodeService::class, function ($app) {
|
||||
return new QrCodeService();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@ -38,6 +43,9 @@ public function boot()
|
||||
*/
|
||||
public function provides()
|
||||
{
|
||||
return [LogoService::class];
|
||||
return [
|
||||
LogoService::class,
|
||||
QrCodeService::class,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -2,25 +2,12 @@
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use App\Models\TwoFAccount;
|
||||
use Zxing\QrReader;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use chillerlan\QRCode\{QRCode, QROptions};
|
||||
|
||||
class QrCodeService
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
//private $token;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
//$this->token = $otpType === TOTP::create($secret) : HOTP::create($secret);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Encode a string into a QR code image
|
||||
*
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
use Tests\FeatureTestCase;
|
||||
use Tests\Classes\LocalFile;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use App\Services\QrCodeService;
|
||||
|
||||
|
||||
/**
|
||||
@ -29,7 +29,7 @@ public function setUp() : void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->qrcodeService = $this->app->make('App\Services\QrCodeService');
|
||||
$this->qrcodeService = $this->app->make(QrCodeService::class);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user