feat: migrate legacy subscription checks to unified payment system

- Replace Laravel Cashier methods with new subscription system
  - Remove session-based subscription checking in bulk components
  - Update Dashboard.php to use PaymentOrchestrator for provider-agnostic sync
  - Maintain backward compatibility with existing Stripe subscriptions
  - Improve performance by eliminating session overhead
  - Add automatic migration of legacy subscriptions to new system

BREAKING CHANGE: Subscription checking now uses unified payment system instead of Laravel Cashier methods
This commit is contained in:
idevakk
2025-11-20 11:05:51 -08:00
parent 4ab8cfceb2
commit 5f5da23a40
5 changed files with 124 additions and 118 deletions

View File

@@ -2,7 +2,6 @@
namespace App\Livewire\Dashboard;
use Illuminate\Support\Facades\Session;
use Livewire\Component;
class Bulk extends Component
@@ -13,8 +12,7 @@ class Bulk extends Component
public function mount(): void
{
$subscriptionCheck = auth()->user()->subscribedToProduct(config('app.plans')[0]['product_id']);
Session::put('isSubscribed', $subscriptionCheck);
// Subscription check is now handled directly in render method
}
public function generateBulk(): void
@@ -50,20 +48,20 @@ class Bulk extends Component
private function randomEmail(): string
{
$domain = $this->getRandomDomain();
if ($domain == 'gmail.com' || $domain == 'googlemail.com') {
if ($domain === 'gmail.com' || $domain === 'googlemail.com') {
$uname = $this->getRandomGmailUser();
$uname_len = strlen((string) $uname);
$len_power = $uname_len - 1;
$combination = 2 ** $len_power;
$rand_comb = mt_rand(1, $combination);
$rand_comb = random_int(1, $combination);
$formatted = implode(' ', str_split((string) $uname));
$uname_exp = explode(' ', $formatted);
$bin = intval('');
$bin = 0;
for ($i = 0; $i < $len_power; $i++) {
$bin .= mt_rand(0, 1);
$bin .= random_int(0, 1);
}
$bin = explode(' ', implode(' ', str_split(strval($bin))));
$bin = explode(' ', implode(' ', str_split((string) $bin)));
$email = '';
for ($i = 0; $i < $len_power; $i++) {
@@ -73,7 +71,7 @@ class Bulk extends Component
}
}
$email .= $uname_exp[$i];
$gmail_rand = mt_rand(1, 10);
$gmail_rand = random_int(1, 10);
if ($gmail_rand > 5) {
$email .= '@gmail.com';
} else {
@@ -82,6 +80,7 @@ class Bulk extends Component
return $email;
}
return $this->generateRandomUsername().'@'.$domain;
}
@@ -148,9 +147,10 @@ class Bulk extends Component
public function render()
{
if (Session::get('isSubscribed')) {
if (auth()->user()->hasActiveSubscription()) {
return view('livewire.dashboard.bulk')->layout('components.layouts.dashboard');
}
return view('livewire.dashboard.not-subscribed')->layout('components.layouts.dashboard');
}
}