Example #1
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     if (!$this->verifyNotInstalled()) {
         return -1;
     }
     $this->clearCaches();
     $config = base_path('.env');
     if (!file_exists($config)) {
         copy(base_path('.env.example'), $config);
         Config::set('app.key', 'SomeRandomString');
     }
     $this->line('');
     $this->info('***********************');
     $this->info('  Welcome to Deployer  ');
     $this->info('***********************');
     $this->line('');
     if (!$this->checkRequirements()) {
         return -1;
     }
     $this->line('Please answer the following questions:');
     $this->line('');
     $config = ['db' => $this->getDatabaseInformation(), 'app' => $this->getInstallInformation(), 'mail' => $this->getEmailInformation()];
     $admin = $this->getAdminInformation();
     $config['jwt']['secret'] = $this->generateJWTKey();
     $this->writeEnvFile($config);
     $this->generateKey();
     $this->migrate($this->getLaravel()->environment() === 'local');
     $this->repository->updateById($admin, 1);
     $this->clearCaches();
     $this->optimize();
     $this->line('');
     $this->info('Success! Deployer is now installed');
     $this->line('');
     $this->header('Next steps');
     $this->line('');
     $this->line('Example configuration files can be found in the "examples" directory');
     $this->line('');
     $this->comment('1. Set up your web server, see either "nginx.conf" or "apache.conf"');
     $this->line('');
     $this->comment('2. Setup the cronjobs, see "crontab"');
     $this->line('');
     $this->comment('3. Setup the socket server & queue runner, see "supervisor.conf" for an example commands');
     $this->line('');
     $this->comment('4. Ensure that "storage" and "public/upload" are writable by the webserver');
     $this->line('');
     $this->comment('5. Visit ' . $config['app']['url'] . ' and login with the details you provided to get started');
     $this->line('');
 }
 /**
  * Change the user's email.
  *
  * @param Request $request
  *
  * @return \Illuminate\Http\RedirectResponse
  */
 public function changeEmail(Request $request)
 {
     $user = $this->repository->findByEmailToken($request->get('token'));
     if ($request->get('email')) {
         $user->email = $request->get('email');
         $user->email_token = '';
         $user->save();
     }
     return redirect()->to('/');
 }
Example #3
0
 /**
  * Execute the console command.
  *
  * @throws \RuntimeException
  * @fires UserWasCreated
  */
 public function handle()
 {
     $arguments = $this->argument();
     $send_email = !$this->option('no-email');
     $password_generated = false;
     if (!$arguments['password']) {
         $arguments['password'] = str_random(15);
         $password_generated = true;
     }
     $validator = Validator::make($arguments, ['name' => 'required|max:255', 'email' => 'required|email|max:255|unique:users,email', 'password' => 'required|min:6']);
     if (!$validator->passes()) {
         throw new RuntimeException($validator->errors()->first());
     }
     $user = $this->repository->create($arguments);
     $message = 'The user has been created';
     if ($send_email) {
         $message = 'The user has been created and their account details have been emailed to ' . $user->email;
         event(new UserWasCreated($user, $arguments['password']));
     } elseif ($password_generated) {
         $message .= ', however you elected to not email the account details to them. ';
         $message .= 'Their password is ' . $arguments['password'];
     }
     $this->info($message);
 }