File tree Expand file tree Collapse file tree
Http/Controllers/Internal/v1 Expand file tree Collapse file tree Original file line number Diff line number Diff 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 ' );
Original file line number Diff line number Diff 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 }
You can’t perform that action at this time.
0 commit comments