예제 #1
0
 /**
  * Handle the command.
  *
  * @param $command
  *
  * @return \Tectonic\Shift\Modules\Identity\Users\Models\User
  */
 public function handle($command)
 {
     $user = User::register($command->firstName, $command->lastName, $command->email, $command->password);
     $this->userRepository->save($user);
     $account = CurrentAccount::get();
     $account->addUser($user);
     $this->eventDispatcher->dispatch($user->releaseEvents());
     return $user;
 }
예제 #2
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());
 }
예제 #3
0
 /**
  * Handle the command.
  *
  * @param $command
  */
 public function handle($command)
 {
     $user = User::add($command->firstName, $command->lastName, $command->email, $command->password);
     $this->userRepository->save($user);
     $this->dispatcher->dispatch($user->releaseEvents());
 }
예제 #4
0
 /**
  * Returns an array of accounts that the user can manage or contribute to.
  *
  * @return array
  */
 public function accounts()
 {
     return $this->user->accounts();
 }