/** * Run the setup process. * * @throws \DreamFactory\Core\Exceptions\BadRequestException */ protected function runSetup() { $force = $this->option('force'); if ($this->isConfigRequired()) { $this->runConfig(); return; } $this->info('**********************************************************************************************************************'); $this->info('* Welcome to DreamFactory setup wizard.'); $this->info('**********************************************************************************************************************'); $this->info('Running Migrations...'); $this->call('migrate', ['--force' => $force]); $this->info('Migration completed successfully.'); $this->info('**********************************************************************************************************************'); $this->info('**********************************************************************************************************************'); $this->info('Running Seeder...'); $this->call('db:seed', ['--force' => $force]); $this->info('All tables were seeded successfully.'); $this->info('**********************************************************************************************************************'); $this->info('**********************************************************************************************************************'); $this->info('Creating the first admin user...'); $user = false; while (!$user) { $firstName = $this->ask('Enter your first name'); $lastName = $this->ask('Enter your last name'); $displayName = $this->ask('Enter display name'); $displayName = empty($displayName) ? $firstName . ' ' . $lastName : $displayName; $email = $this->ask('Enter your email address?'); $password = $this->secret('Choose a password'); $passwordConfirm = $this->secret('Re-enter password'); $data = ['first_name' => $firstName, 'last_name' => $lastName, 'email' => $email, 'password' => $password, 'password_confirmation' => $passwordConfirm, 'name' => $displayName]; $user = User::createFirstAdmin($data); if (!$user) { $this->error('Failed to create user.' . print_r($data['errors'], true)); $this->info('Please try again...'); } } $this->info('Successfully created first admin user.'); $this->info('**********************************************************************************************************************'); $this->dirWarn(); $this->info('*********************************************** Setup Successful! ****************************************************'); $this->info('* Setup is complete! Your instance is ready. Please launch your instance using a browser.'); $this->info('* You can run "php artisan serve" to try out your instance without setting up a web server.'); $this->info('**********************************************************************************************************************'); }
public function createFirstUser() { if (!User::adminExists()) { $request = \Request::instance(); $method = $request->method(); if (Verbs::GET === $method) { $data = ['version' => \Config::get('df.version'), 'email' => '', 'name' => '', 'first_name' => '', 'last_name' => '']; return view('firstUser', $data); } else { if (Verbs::POST === $method) { $data = $request->all(); $user = User::createFirstAdmin($data); if (!$user) { return view('firstUser', $data); } } } } return redirect()->to('/'); }