Skip to content

Commit 0072bdb

Browse files
committed
onboarding complete on account creation in reguar flow
1 parent e4ac75f commit 0072bdb

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

src/Http/Controllers/Internal/v1/OnboardController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function createAccount(OnboardRequest $request)
5858
]);
5959

6060
// create company FIRST (required for billing resource tracking)
61-
$company = Company::create(['name' => $request->input('organization_name')]);
61+
$company = Company::create(['name' => $request->input('organization_name'), 'onboarding_completed_at' => now()]);
6262

6363
// set company_uuid before creating user (required for billing resource tracking)
6464
$attributes['company_uuid'] = $company->uuid;
@@ -73,7 +73,7 @@ public function createAccount(OnboardRequest $request)
7373
$user->setUserType($isAdmin ? 'admin' : 'user');
7474

7575
// set company owner
76-
$company->setOwner($user)->save();
76+
$company->setOwner($user, true)->save();
7777

7878
// assign user to organization
7979
$user->assignCompany($company, 'Administrator');

src/Models/Company.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,9 +254,12 @@ public function assignOwner(User $user): User
254254
*
255255
* @return Company
256256
*/
257-
public function setOwner(User $user)
257+
public function setOwner(User $user, bool $completedOnboarding = false)
258258
{
259259
$this->owner_uuid = $user->uuid;
260+
if ($completedOnboarding) {
261+
$this->onboarding_completed_by_uuid = $user->uuid;
262+
}
260263

261264
return $this;
262265
}

0 commit comments

Comments
 (0)