diff --git a/app/Api/v1/Controllers/QrCodeController.php b/app/Api/v1/Controllers/QrCodeController.php index bce35a59..81d3483e 100644 --- a/app/Api/v1/Controllers/QrCodeController.php +++ b/app/Api/v1/Controllers/QrCodeController.php @@ -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; } diff --git a/app/Providers/TwoFAuthServiceProvider.php b/app/Providers/TwoFAuthServiceProvider.php index ba2efaa9..cf8e28f0 100644 --- a/app/Providers/TwoFAuthServiceProvider.php +++ b/app/Providers/TwoFAuthServiceProvider.php @@ -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, + ]; } } diff --git a/app/Services/QrCodeService.php b/app/Services/QrCodeService.php index be790e3f..95ed5bcd 100644 --- a/app/Services/QrCodeService.php +++ b/app/Services/QrCodeService.php @@ -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 * diff --git a/tests/Feature/Services/QrCodeServiceTest.php b/tests/Feature/Services/QrCodeServiceTest.php index fce0ddc7..7d90f822 100644 --- a/tests/Feature/Services/QrCodeServiceTest.php +++ b/tests/Feature/Services/QrCodeServiceTest.php @@ -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); }