Create the new admin with input from the user

@return void
968102
public function handle()
    {
        $firstName = $this->ask('First Name');
        $lastName = $this->ask('Last Name');
        $email = $this->ask('Email');

        // Check the email to see if its already being used
        if ($admin = BkwldAdmin::where('email', $email)->exists()) {
            $this->error('That email is already in use');

            return;
        }

        $password = $this->secret('Enter your password');
        $confirm = $this->secret('Confirm your password');

        // password matching check
        if ($password != $confirm) {
            $this->error('Your passwords do not match.');

            return;
        }

        // Create a new admin
        $admin = new BkwldAdmin;
        $admin->first_name = $firstName;
        $admin->last_name = $lastName;
        $admin->email = $email;
        $admin->password = $password;

        // Save out the new admin
        $admin->save();
        $this->info('Admin created!');
    }
1089151
public function getPostAdminCreateUser()
    {
        $form = new CreateUserForm2($this->di);
        $form->check();

        $views = [
            ["comment/admin/navbar", [], "main"],
            ["comment/admin/crud/edit", ["form" => $form->getHTML()], "main"]
        ];

        $this->di->get("pageRenderComment")->renderPage([
            "views" => $views,
            "title" => "Create user"
        ]);
    }
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);
        });
    }
277799
protected function createAdminUser($admin, $output)
    {
        try {
            $this->reloadConfig();

            $userStore = Factory::getStore('User');
            $userService = new UserService($userStore);
            $userService->createUser($admin['name'], $admin['mail'], $admin['pass'], 1);

            $output->writeln('<info>'.Lang::get('user_created').'</info>');
        } catch (\Exception $ex) {
            $output->writeln('<error>'.Lang::get('failed_to_create').'</error>');
            $output->writeln('<error>' . $ex->getMessage() . '</error>');
        }
    }
1072538
protected function createFirstUser()
    {
        $info = [
            'first_name' => $this->askForFirstName(),
            'last_name'  => $this->askForLastName(),
            'email'      => $this->askForEmail(),
            'password'   => $this->askForPassword(),
            'created_at' => Carbon::now(),
            'updated_at' => Carbon::now(),
        ];

        $this->application->make('Modules\User\Repositories\UserRepository')->createWithRoles(
            $info,
            $this->getAdminRole()
        );

        $this->command->info('Admin account created!');
    }
213624
function create()
    {
        $content = $this->loadContentTypes();
        $templates = $this->loadTemplates();
        restoreRequest();
        $form = array (
            'name' => 'createPage',
            'caption' => strAdd,
            'width' => '600px',
            'fields' => array (
                array ('type' => 'hidden','name'=>'owner','value'=>arg('owner', 'int')),
                array ('type' => 'hidden','name'=>'action', 'value'=>'insert'),
                array ('type' => 'edit','name' => 'name','label' => admPagesName,'width' => '150px',
                    'maxlength' => '32', 'pattern'=>'/^[a-z0-9_]+$/i', 'errormsg'=>admPagesNameInvalid),
                array ('type' => 'edit','name' => 'title','label' => admPagesTitle,'width' => '100%',
                    'pattern'=>'/.+/', 'errormsg'=>admPagesTitleInvalid),
                array ('type' => 'edit','name' => 'caption','label' => admPagesCaption,'width' => '100%',
                    'maxlength' => '64', 'pattern'=>'/.+/', 'errormsg'=>admPagesCaptionInvalid),
                array ('type' => 'edit','name' => 'hint','label' => admPagesHint,'width' => '100%'),
                array ('type' => 'edit','name' => 'description','label' => admPagesDescription,
                    'width' => '100%'),
                array ('type' => 'edit','name' => 'keywords','label' => admPagesKeywords,'width' => '100%'),
                array ('type' => 'select','name' => 'template','label' => admPagesTemplate,
                    'items' => $templates[0], 'values' => $templates[1], 'default'=>pageTemplateDefault),
                array ('type' => 'select','name' => 'type','label' => admPagesContentType,
                    'items' => $content[0], 'values' => $content[1], 'default'=>contentTypeDefault),
                array ('type' => 'checkbox','name' => 'active','label' => admPagesActive, 'default'=>true),
                array ('type' => 'checkbox','name' => 'visible','label' => admPagesVisible,
                    'default'=>true),
                array ('type' => 'select','name' => 'access','label' => admAccessLevel,'access' => ADMIN,
                    'values'=>array(ADMIN,EDITOR,USER,GUEST),
                    'items' => array (ACCESSLEVEL2,ACCESSLEVEL3,ACCESSLEVEL4,ACCESSLEVEL5),
                    'default' => GUEST),
                array ('type' => 'edit','name' => 'position','label' => admPosition,'access' => ADMIN,
                    'width' => '4em','maxlength' => '5'),
                array ('type' => 'memo','name' => 'options','label' => admPagesOptions,'height' => '5')
            ),
            'buttons' => array('ok', 'cancel'),
        );

        /** @var TAdminUI $page */
        $page = Eresus_Kernel::app()->getPage();
        $result = $page->renderForm($form, Eresus_CMS::getLegacyKernel()->request['arg']);
        return $result;
    }
317696
public function add()
    {
        $this->loadModel('User.Users');
        $user = $this->Users->newEntity();
        $user = $this->Users->attachFields($user);
        $languages = LocaleToolbox::languagesList();
        $roles = $this->Users->Roles->find('list', [
            'conditions' => [
                'id NOT IN' => [ROLE_ID_AUTHENTICATED, ROLE_ID_ANONYMOUS]
            ]
        ]);

        if ($this->request->data()) {
            $user->accessible('id', false);
            $data = $this->request->data;

            if (isset($data['welcome_message'])) {
                $sendWelcomeMessage = (bool)$data['welcome_message'];
                unset($data['welcome_message']);
            } else {
                $sendWelcomeMessage = false;
            }

            $user = $this->Users->patchEntity($user, $data);
            if ($this->Users->save($user)) {
                if ($sendWelcomeMessage) {
                    NotificationManager::welcome($user)->send();
                }

                $this->Flash->success(__d('user', 'User successfully registered!'));
                $this->redirect(['plugin' => 'User', 'controller' => 'manage', 'action' => 'edit', $user->id]);
            } else {
                $this->Flash->danger(__d('user', 'User could not be registered, please check your information.'));
            }
        }

        $this->title(__d('user', 'Register New User'));
        $this->set(compact('user', 'roles', 'languages'));
        $this->Breadcrumb->push('/admin/user/manage');
    }
1312991
def make_admin(user):
    '''
    
    '''
    tutor_group, owner_group = _get_user_groups()
    user.is_staff = True
    user.is_superuser = True
    user.save()
    owner_group.user_set.add(user)
    owner_group.save()
    tutor_group.user_set.add(user)
    tutor_group.save()
689946
public function actionAdmin()
	{
		$model=new Post('search');
		if(isset($_GET['Post']))
			$model->attributes=$_GET['Post'];
		$this->render('admin',array(
			'model'=>$model,
		));
	}
703056
protected function createDB()
    {
        $this->output->writeLn("Generating MySQL database based on the environment's configuration.");
        $command = sprintf("%s db create", $this->getWpCliPath());
        system($command);

        $this->nl();

        $title = 'StrataEnvironment';
        $adminUser = "admin";
        $adminPassword = "admin";
        $adminEmail = "admin@yourdomain.com";

        $this->output->writeLn("Installing using the following administrator information:");
        $this->output->writeLn("  Title:      $title");
        $this->output->writeLn("  User:       $adminUser");
        $this->output->writeLn("  Password:   $adminPassword");
        $this->output->writeLn("  Email:      $adminEmail");

        $command = sprintf("%s core install --url=%s --title=%s --admin_user=%s --admin_password=%s --admin_email=%s", $this->getWpCliPath(), WP_HOME, $title, $adminUser, $adminPassword, $adminEmail);
        system($command);
    }
176853
def create_user
      @admin = Admin.new(administrator_params)
      @admin.access_level = 'admin'
      @admin.overlord = 'Y'
      
      respond_to do |format|
        if @admin.save
          Setting.save_data({setup_complete: 'Y'})
          clear_cache
          session[:setup_complete] = true
          format.html { redirect_to admin_path, notice: I18n.t("controllers.admin.setup.general.success") }
        else
          format.html { render action: "administrator" }
        end
      end

    end
162166
protected function createUsersTable()
    {
        Schema::create('users', function (Blueprint $table) {
            $table->increments('id');
            $table->string('name');
            $table->string('email')->unique();
            $table->string('password', 60);
            $table->rememberToken();
            $table->timestamps();
        });
    }
13176
public function create()
	{
		// Element fields, so don´t use parent construct method
		$GLOBALS['TL_DCA']['tl_content']['palettes'][$this->element] .= ',protected';
		$GLOBALS['TL_DCA']['tl_content']['fields']['protected']['eval']['tl_class'] = 'clr'; // push to new row (clear)

		// The groups field
		if (!$this->canChangeGroups)
		{
			if(($key = array_search('protected', $GLOBALS['TL_DCA']['tl_content']['palettes']['__selector__'])) !== false) {
				unset($GLOBALS['TL_DCA']['tl_content']['palettes']['__selector__'][$key]);
			}
			
			unset($GLOBALS['TL_DCA']['tl_content']['subpalettes']['protected']);
			
			$GLOBALS['TL_DCA']['tl_content']['fields']['protected']['eval']['submitOnChange'] = false;
			
			// Overwrite the elements groups with groups from the pattern
			$db = Database::getInstance();
			$db->prepare("UPDATE tl_content SET groups=? WHERE id=?")
			   ->execute($this->groups, $this->cid);
		}
		
		// The guests field
		if ($this->canChangeGuests)
		{
			$GLOBALS['TL_DCA']['tl_content']['palettes'][$this->element] .= ',guests';
		}
	}
446394
public function add()
    {
        $user = $this->Users->newEntity();

        $user->accessible('role_id', true); // the role_id field should be accessible
        $user->accessible('active', true); // the active field should be accessible
        $user->accessible('send_mail', true); // checkbox to send an e-mail

        $roles = $this->Users->Roles->find('list');

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

            if (!$user->get('active')) {
                $user->set('activation_key', $this->Users->generateActivationKey());
            }

            if ($this->Users->save($user)) {
                // firing an event: afterRegister
                $_event = new Event('Controller.Users.afterRegister', $this, [
                    'user' => $user,
                    'sendMail' => $user->send_mail
                ]);
                $this->eventManager()->dispatch($_event);
                $this->Flash->success(__('The user has been saved.'));
                return $this->redirect(['action' => 'index']);
            } else {
                $this->Flash->error(__('The user could not be saved. Please, try again.'));
            }
        }

        $customFields = Hash::normalize(Configure::read('CM.UserFields'));

        $this->set(compact('user', 'roles', 'customFields'));

        $this->render(Configure::read('CM.AdminUserViews.add'));
    }
1282057
private function createAdminUser(InputInterface $input, OutputInterface $output)
    {
        $arguments = [];

        $arguments['command'] = 'fos:user:create';

        if ($input->getOption('username')) {
            $arguments['username'] = $input->getOption('username');
        }
        if ($input->getOption('email')) {
            $arguments['email'] = $input->getOption('email');
        }
        if ($input->getOption('password')) {
            $arguments['password'] = $input->getOption('password');
        }
        $command = $this->getApplication()->find('fos:user:create');

        $arguments['--super-admin'] = true;

        $input = new ArrayInput($arguments);

        return $command->run($input, $output);
    }
931812
protected function createSuperadmin()
    {
        $this->setCliMessage('Creating superadmin...');

        $user = array(
            'status' => 1,
            'name' => 'Superadmin',
            'store_id' => $this->context['store_id'],
            'email' => $this->data['user']['email'],
            'password' => $this->data['user']['password']
        );

        $user_id = $this->getUserModel()->add($user);

        $this->config->set('user_superadmin', $user_id);
        $this->setContext('user_id', $user_id);
    }
783874
public function create()
    {
        if (!$this->name) {
            throw new UnexpectedValueException(
                'Cannot create a user with no name'
            );
        }

        $parts = array('CREATE USER :user');
        $params = array(':user' => $this->name);

        if ($this->host) {
            $parts[] = '@:host';
            $params[':host'] = strtolower($this->host) == 'any' ? '%' : $this->host;
        }
        if ($this->password) {
            $parts[] = 'IDENTIFIED BY :password';
            $params[':password'] = $this->password;
        }

        // Wrap in 'FLUSH PRIVILEGES' commands to update in-memory state
        $this->client->execute('FLUSH PRIVILEGES');
        $this->client->execute(implode(' ', $parts), $params);
        $this->client->execute('FLUSH PRIVILEGES');
    }