diff --git a/app/Http/Controllers/Auth/RegisteredUserController.php b/app/Http/Controllers/Auth/RegisteredUserController.php index 292d854..091874b 100644 --- a/app/Http/Controllers/Auth/RegisteredUserController.php +++ b/app/Http/Controllers/Auth/RegisteredUserController.php @@ -39,7 +39,6 @@ class RegisteredUserController extends Controller { $fullName = trim($request->first_name.' '.$request->last_name); - $validated = $request->validate([ 'username' => ['required', 'string', 'max:255', 'unique:'.User::class], 'email' => ['required', 'string', 'lowercase', 'email', 'max:255', 'unique:'.User::class], @@ -75,6 +74,7 @@ class RegisteredUserController extends Controller 'name' => $fullName, 'slug' => Str::slug($fullName.'-'.now()->timestamp), 'email' => $request->email, + 'contact_email' => $request->email, 'is_active' => true, 'is_suspended' => false, 'subscription_tier' => 'free', diff --git a/app/Http/Controllers/CheckoutController.php b/app/Http/Controllers/CheckoutController.php index 16d6123..69cbcc8 100644 --- a/app/Http/Controllers/CheckoutController.php +++ b/app/Http/Controllers/CheckoutController.php @@ -98,6 +98,7 @@ class CheckoutController extends Controller 'name' => $validated['first_name'].' '.$validated['last_name'], 'slug' => Str::slug($validated['first_name'].' '.$validated['last_name'].'-'.now()->timestamp), 'email' => $validated['email'], + 'contact_email' => $validated['email'], 'is_active' => true, 'is_suspended' => false, 'subscription_tier' => 'free', diff --git a/app/Services/Checkout/CheckoutAssignmentService.php b/app/Services/Checkout/CheckoutAssignmentService.php index 1f25e56..e98f0de 100644 --- a/app/Services/Checkout/CheckoutAssignmentService.php +++ b/app/Services/Checkout/CheckoutAssignmentService.php @@ -166,6 +166,7 @@ class CheckoutAssignmentService 'name' => $session->package_snapshot['name'] ?? $user->name, 'slug' => Str::slug(($user->name ?: $user->email).' '.now()->timestamp), 'email' => $user->email, + 'contact_email' => $user->email, 'is_active' => true, 'is_suspended' => false, 'subscription_tier' => 'free', diff --git a/tests/Feature/Auth/RegistrationTest.php b/tests/Feature/Auth/RegistrationTest.php index 714b0ca..24db22f 100644 --- a/tests/Feature/Auth/RegistrationTest.php +++ b/tests/Feature/Auth/RegistrationTest.php @@ -54,6 +54,7 @@ class RegistrationTest extends TestCase $this->assertDatabaseHas('users', ['email' => 'test@example.com']); $this->assertDatabaseHas('tenants', [ 'user_id' => User::latest()->first()->id, + 'contact_email' => 'test@example.com', ]); } diff --git a/tests/Feature/Checkout/CheckoutAuthTest.php b/tests/Feature/Checkout/CheckoutAuthTest.php index fa0fe00..806a898 100644 --- a/tests/Feature/Checkout/CheckoutAuthTest.php +++ b/tests/Feature/Checkout/CheckoutAuthTest.php @@ -178,6 +178,7 @@ class CheckoutAuthTest extends TestCase $this->assertDatabaseHas('tenants', [ 'email' => 'test@example.com', + 'contact_email' => 'test@example.com', ]); $this->assertDatabaseHas('tenant_packages', [