Example #1
0
 public function execute()
 {
     if ($this->artisan->confirm("Create Admin user now? (requires working db connection)", true)) {
         $this->artisan->info("Create an Admin user");
         $user['name'] = $this->artisan->ask("Administrator's name");
         $user['email'] = $this->artisan->ask("Administrator email address");
         $matches = false;
         while (!$matches) {
             $user['password'] = $this->artisan->secret("Administrator password");
             $user['password_confirmation'] = $this->artisan->secret("Confirm password");
             $matches = $user['password'] === $user['password_confirmation'];
         }
         $user['password'] = bcrypt($user['password']);
         unset($user['password_confirmation']);
         // Persist the user
         $admin = User::create($user);
         $admin->admin = true;
         $admin->save();
         $this->artisan->comment("Created admin user {$admin->email}");
     }
 }
Example #2
0
 /**
  * @param Request $request
  */
 public function store(Request $request)
 {
     User::create($request->all());
 }
Example #3
0
 /**
  * @param UserCreateRequest $request
  * @return \Illuminate\Http\RedirectResponse
  */
 public function store(UserCreateRequest $request)
 {
     $user = User::create($this->buildUserFromRequest($request));
     return redirect()->route('admin::users.index');
 }
Example #4
0
 /**
  * Store a newly created user in storage.
  *
  * @param \Flashtag\Api\Http\Requests\CreateUserRequest $request
  * @return \Dingo\Api\Http\Response
  */
 public function store(CreateUserRequest $request)
 {
     $user = User::create(['email' => $request->get('email'), 'name' => $request->get('name'), 'password' => bcrypt($request->get('password'))]);
     return $this->response->item($user, new UserTransformer());
 }
Example #5
0
 /**
  * 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'])]);
 }