diff --git a/app/Http/Controllers/TwoFactorController.php b/app/Http/Controllers/TwoFactorController.php index 2fb44afe5ff2..4b0a07717b30 100644 --- a/app/Http/Controllers/TwoFactorController.php +++ b/app/Http/Controllers/TwoFactorController.php @@ -47,11 +47,13 @@ class TwoFactorController extends BaseController public function enableTwoFactor() { + $google2fa = new Google2FA(); + $user = auth()->user(); $secret = request()->input('secret'); $oneTimePassword = request()->input('one_time_password'); - if (! $secret || ! Google2FA::verifyKey($secret, $oneTimePassword)) { + if (! $secret || ! $google2fa->verifyKey($secret, $oneTimePassword)) { return response()->json('message' > ctrans('texts.invalid_one_time_password')); } elseif (! $user->google_2fa_secret && $user->phone && $user->confirmed) { $user->google_2fa_secret = encrypt($secret); diff --git a/app/Models/BillingSubscription.php b/app/Models/BillingSubscription.php index 486e3134d607..10f6d15564f4 100644 --- a/app/Models/BillingSubscription.php +++ b/app/Models/BillingSubscription.php @@ -11,6 +11,7 @@ namespace App\Models; +use App\Services\BillingSubscription\BillingSubscriptionService; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\SoftDeletes; @@ -53,6 +54,11 @@ class BillingSubscription extends BaseModel 'deleted_at' => 'timestamp', ]; + public function service() + { + return new BillingSubscriptionService($this); + } + public function company(): \Illuminate\Database\Eloquent\Relations\BelongsTo { return $this->belongsTo(Company::class);