Store a new user.

@return \Illuminate\Http\Response
1707
public function store()
    {
        $password = Str::random();

        $input = array_merge(Binput::only(['first_name', 'last_name', 'email']), [
            'password'     => $password,
            'activated'    => true,
            'activated_at' => new DateTime(),
        ]);

        $rules = UserRepository::rules(array_keys($input));
        $rules['password'] = 'required|min:6';

        $val = UserRepository::validate($input, $rules, true);
        if ($val->fails()) {
            return Redirect::route('users.create')->withInput()->withErrors($val->errors());
        }

        try {
            $user = UserRepository::create($input);

            $groups = GroupRepository::index();
            foreach ($groups as $group) {
                if (Binput::get('group_'.$group->id) === 'on') {
                    $user->addGroup($group);
                }
            }

            $mail = [
                'url'      => URL::to(Config::get('credentials.home', '/')),
                'password' => $password,
                'email'    => $user->getLogin(),
                'subject'  => Config::get('app.name').' - New Account Information',
            ];

            Mail::queue('credentials::emails.newuser', $mail, function ($message) use ($mail) {
                $message->to($mail['email'])->subject($mail['subject']);
            });

            return Redirect::route('users.show', ['users' => $user->id])
                ->with('success', 'The user has been created successfully. Their password has been emailed to them.');
        } catch (UserExistsException $e) {
            return Redirect::route('users.create')->withInput()->withErrors($val->errors())
                ->with('error', 'That email address is taken.');
        }
    }
586530
public function store()
    {
        $user    = null;
        $message = '';
        $success = false;

        try{
            $input = Input::post();

            if($input['password'] != $input['confirm_password']){
                throw new Exception("Password and confirmation password not match", 1);
            }

            $user = Sentry::createUser(array(
                'email'       => $input['email'],
                'password'    => $input['password'],
                'first_name'  => $input['first_name'],
                'last_name'   => $input['last_name'],
                'activated'   => 1
            ));

            $success = true;
            $message = 'User created successfully';
        }catch (Exception $e){
            $message = $e->getMessage();
        }

        if(Request::isAjax()){
            Response::headers()->set('Content-Type', 'application/json');
            Response::setBody(json_encode(
                array(
                    'success'   => $success,
                    'data'      => ($user) ? $user->toArray() : $user,
                    'message'   => $message,
                    'code'      => $success ? 200 : 500
                )
            ));
        }else{
            Response::redirect($this->siteUrl('admin/user'));
        }
    }
817545
public function save()
    {
        // Find record if we have an ID, otherwise create a new record
        $user = (Input::get('id')) ? User::with('addresses')->find(Input::get('id')) : new User;
        $result = $user->saveRecursive();

        // Capture errors to return via JSON model if we have some
        if ( ! $result) $user->errors = $user->getErrors();

        return $user;
    }
395545
public function store(CreateUserRequest $request, User $user)
    {
        $this->authorize(UsersPolicy::PERMISSION_CREATE);

        $user->fill($request->getValidatedData());
        $user->is_active = true;
        $user->save();
        $user->roles()->sync($request->get('roles'));

        $this->transNotification('created', ['name' => $user->full_name], $user->toArray());

        return redirect()->route('admin::auth.users.index');
    }
324973
public function store(Request $request)
    {
        try {
            $this->dispatch(new AttemptUserLogin($request->get('email'), $request->get('password'), $request->get('remember')));
            return redirect()->intended($this->config->get('authentication.login.redirectUri'));
        } catch (LoginFailed $e) {
            return redirect()->back()->withInput()->withErrors([
                'authentication::login_error' => $e->getMessage()
            ]);
        } catch (UserIsBanned $e) {
            return redirect()->back()->withInput()->withErrors([
                'authentication::login_error' => $e->getMessage()
            ]);
        }
    }
1129611
private function seedAdminUser()
    {
        tap(new User($this->getAdminUserAttributes()), function (User $admin) {
            $admin->save();

            /** @var  \Arcanesoft\Auth\Models\Role  $adminRole */
            $adminRole = Role::admin()->first();
            $adminRole->attachUser($admin);
        });
    }
542719
public function create()
    {
        if ($this->createStatement == null) {
            $this->createStatement = $this->connection->prepare("
            INSERT INTO User (username,mail,password,id,parent) VALUES (?,?,?,?,?)");
            $this->createStatement->bindParam(1, $this->username);
            $this->createStatement->bindParam(2, $this->mail);
            $this->createStatement->bindParam(3, $this->password);
            $this->createStatement->bindParam(4, $this->userId);
            $this->createStatement->bindParam(5, $this->parentID);
        }
        try {
            $this->createStatement->execute();
        } catch (PDOException $e) {
            return false;
        }
        $this->setInitialValues();
        return $this->exists();
    }
650040
public function store(UserRequest $request)
    {
        $this->model->fill($request->all())->save();

        return $this->makeRedirect(true, 'admin.users.index', __('store'));
    }
945414
public function store(UserRequest $request)
    {
        $user = User::make($request->all());

        $user->password = bcrypt(str_random(12));
        $user->api_token = bcrypt(str_random(12));

        $user->save();

        if (is_numeric($roles = $request->roleids)) {
            $roles = [$roles];
        }

        if (is_array($roles)) {
            $user->setRolesById($roles);
        }

        /**
         * Next, let's send a password reset instructions email to the newly created user
         * to enable them to set a password and login to use the Application.
         */
        $user->sendPasswordNotification($this->broker()->createToken($user), $request);

        return response()->json([], 200);
    }
1054477
public function store($request)
    {
        $this->fireEvent('creating', [$request]);

        $created = $this->model->create($request);

        $this->fireEvent('created', [$created]);

        return $created;
    }
622245
public function store()
    {
        // Create a new object
        $item = new $this->model;

        // Remove nested model data from input and prepare to insert on save
        $input = (new NestedModels)->relateTo($item);

        // Hydrate the object
        $item->fill($input);

        // Validate and save.
        $this->validate($item);
        if ($this->parent) {
            $this->parent->{$this->parent_to_self}()->save($item);
        } else {
            $item->save();
        }

        // Redirect to edit view
        if (Request::ajax()) {
            return Response::json(['id' => $item->id]);
        } else {
            return Redirect::to(DecoyURL::relative('edit', $item->id))
            ->with('success', $this->successMessage($item, 'created'));
        }
    }
577465
public function loggedIn()
    {
        if (parent::loggedIn()) {
            $account = new Account($_SESSION[ 'account' ]);

            if ($user = models('users')->findWhere(['username' => $account->username], 1)) {
                // Store Account Profile
                if ($profile = $user->profile) {
                    $account->store('profile', $profile);
                }

                // Store Account Role
                if ($role = $user->role) {
                    $account->store('role', new Role([
                        'label'       => $role->label,
                        'description' => $role->description,
                        'code'        => $role->code,
                        'authorities' => $role->authorities,
                    ]));
                }
            }
            
            // Store Globals Account
            globals()->store('account', $account);

            // Store Presenter Account
            if (services()->has('view')) {
                presenter()->store('account', $account);
            }

            return true;
        }

        return false;
    }
152544
public function store(CreateUserRequest $request)
    {
        $user = User::create([
            'name' => $request->input('name'),
            'email' => $request->input('email'),
            'password' => bcrypt($request->input('password')),
        ]);

        event(new UserCreated($user));

        return $user;
    }
794717
public function add()
    {
        $user = $this->Users->newEntity();

        if ($this->request->is('post')) {
            $user = $this->Users->patchEntity($user, $this->request->getData());

            if ($this->Users->save($user)) {
                $this->Flash->success(I18N_OPERATION_OK);

                return $this->redirect(['action' => 'index']);
            }

            $this->Flash->error(I18N_OPERATION_NOT_OK);
        }

        $this->set(compact('user'));
    }
305936
public function store()
    {
        if ($this->id !== null) {
            $method = 'PUT';
            $path = '/' . $this->id;
        } else {
            $method = 'POST';
            $path = '';
        }
        $response = $this->request($method, $path, [], json_encode($this->data));
        $treatedContent = $response->getTreatedContent();

        $this->id = $treatedContent['_id'];
        $this->version = $treatedContent['_version'];
        $this->dirty = false;
    }
909921
public function store()
	{
		( $id = $this->item->getId() ) !== null ? $this->checkId( $id ) : $this->checkLimit();
		$context = $this->getContext();

		if( $id === null )
		{
			$msg = $this->item->toArray();
			$msg['customer.password'] = null;

			// Show only generated passwords in account creation e-mails
			if( $this->item->getPassword() === '' ) {
				$msg['customer.password'] = substr( sha1( microtime( true ) . getmypid() . rand() ), -8 );
			}

			$context->getMessageQueue( 'mq-email', 'customer/email/account' )->add( json_encode( $msg ) );
		}

		$this->item = $this->manager->saveItem( $this->item );
		return $this;
	}
994712
public function store()
	{
		$attributes = request()->validate(NewsletterSubscriber::$rules, NewsletterSubscriber::$messages);

        $subscriber = $this->createEntry(NewsletterSubscriber::class, $attributes);

        return redirect_to_resource();
	}