/** * @return static */ public function handle() { if (!($this->photo && $this->provider && $this->provider_id)) { $user = User::create(['name' => $this->name, 'email' => $this->email, 'password' => $this->password, 'locale' => App::getLocale()]); } else { $user = User::create(['name' => $this->name, 'email' => $this->email, 'photo' => $this->photo, 'provider' => $this->provider, 'provider_id' => $this->provider_id, 'password' => $this->password, 'locale' => App::getLocale()]); } event(new UserWasCreatedEvent($user)); return $user; }
/** * @param CreateUserCommand $command * @return static */ public function handle(CreateUserCommand $command) { $user = User::create(['name' => $command->name, 'email' => $command->email, 'photo' => $command->photo, 'provider' => $command->provider, 'provider_id' => $command->provider_id]); Event::fire(new UserWasCreatedEvent($user)); return $user; }