Ejemplo n.º 1
0
 /**
  * Handles the configuration and installation of Platform.
  *
  * @return mixed
  */
 public function configure()
 {
     $this->installer->setUserData(request()->input('user', []));
     $this->installer->setDatabaseData($driver = request()->input('database.driver'), request()->input("database.{$driver}", []));
     $messages = $this->installer->validate();
     if (!$messages->isEmpty()) {
         return redirect()->back()->withLicense(true)->withInput()->withErrors($messages);
     }
     try {
         $this->installer->install();
     } catch (\Exception $e) {
         return redirect()->back()->withLicense(true)->withInput()->withErrors($e->getMessage());
     }
     return redirect('installer/complete');
 }
Ejemplo n.º 2
0
    /**
     * Prompts the user for the user credentials.
     *
     * @return void
     */
    protected function askDefaultUserDetails()
    {
        $this->output->writeln(<<<STEP
<fg=yellow>
*-----------------------------------------------*
|                                               |
|       Step #2: Configure Default User         |
|                                               |
*-----------------------------------------------*
</fg=yellow>
STEP
);
        $userData = [];
        $userData['email'] = $this->askQuestion('<fg=green>Please enter the user email</fg=green>: ', null, false, function ($answer) {
            if (!$answer) {
                throw new \RuntimeException('The email is required!');
            }
            return $answer;
        });
        $userData['password'] = $this->askQuestion('<fg=green>Please enter the user password</fg=green>: ', null, true, function ($answer) {
            if (!$answer) {
                throw new \RuntimeException('The password is required!');
            }
            return $answer;
        });
        $this->askQuestion('<fg=green>Please confirm the user password</fg=green>: ', null, true, function ($answer) use($userData) {
            if (!$answer) {
                throw new \RuntimeException('The password confirmation is required!');
            }
            if ($answer !== $userData['password']) {
                throw new \RuntimeException('The passwords doesn\'t match!');
            }
            return $answer;
        });
        $this->installer->setUserData($userData);
    }