コード例 #1
0
 /**
  * Handle the command.
  *
  * @param $command
  */
 public function handle($command)
 {
     // Create account
     $account = Account::install();
     // Add new user record and assign to account
     $user = User::install($command->email, $command->password);
     $this->users->save($user);
     $account->setOwner($user);
     $this->accountRepository->save($account);
     // Set the current account for the request. This is necessary for some other tasks
     CurrentAccount::set($account);
     $language = $this->addLanguage($account, $command->language);
     $account->addUser($user);
     $account->addTranslation($language->code, 'name', $command->name);
     $account->addDomain($command->host);
     // Dispatch all events associated with various objects
     $this->dispatcher->dispatch($account->releaseEvents());
     $this->dispatcher->dispatch($user->releaseEvents());
 }