/** * Execute the console command. * * @return mixed */ public function handle() { $username = $this->argument('name'); $email = $this->ask('Input user email'); $password = $this->secret('Input password'); $password_confirm = $this->secret('Confirm password'); if ($password == $password_confirm) { $this->user->create(['name' => $username, 'email' => $email, 'password' => Hash::make($password)]); $this->info('User created: ' . $username); } else { $this->error('Problem creating user.'); } }
/** * Create a new user instance after a valid registration. * * @param array $data * @return User */ protected function create(array $data) { return User::create(['name' => $data['name'], 'email' => $data['email'], 'password' => bcrypt($data['password'])]); }