/** * Process the flow of creating a new user * * @return \Illuminate\Database\Eloquent\Model|mixed * @throws \Exception */ protected function doCreate() { try { $this->repoWrapper->begin(); $createdUser = $this->userRepo->createRaw($this->getUserData()); $createdUser = $this->addCommandRolesToUser($createdUser); $createdUser = $this->addCommandCategoriesToUser($createdUser); } catch (\Exception $e) { $this->repoWrapper->failure(); throw $e; } $this->repoWrapper->end(); return $createdUser; }
/** * Create admin user * * @return \Illuminate\Database\Eloquent\Model */ private function createUser() { $user = $this->userRepo->createRaw(['user_name' => $this->ask('What is admin`s username? ', 'bigsinoos'), 'password' => Hash::make($this->ask('What is admin`s password? ', '1q2w3e')), 'email' => $this->ask('What is admin`s email? ', '*****@*****.**'), 'name' => $this->ask('What is admin`s name? ', 'Reza Shadman')]); return $user; }