/** * @return void */ public function handle() { $password = (string) new RandomPassword(); $this->credentials['password'] = Auth::hash($password); try { $person = Person::create($this->credentials); } catch (DuplicateEmailException $e) { } if (isset($person)) { foreach ($this->groups as $groupId) { $person->addGroup(Group::find($groupId)); } Event::fire(new AccountCreated($person, $password, Auth::getPerson())); return $person; } else { return Person::findByEmail($this->credentials['email']); } }