/** * Execute the console command. * * @return mixed */ public function handle() { $email = $this->ask('Enter the email'); $password = $this->ask('Type in the password to complete, 3 characters minimum'); $user = User::createAdmin(['username' => $this->argument('username'), 'name' => $this->argument('username'), 'email' => $email, 'password' => bcrypt($password)]); if ($user) { $this->info('User successfully created, Username: ' . $user->username); } }
/** * Create the admin account and migrate the database. * * @param $credentials * @author Cali */ protected function migrateAndCreateAdmin($credentials) { env_put('ADMIN_EMAIL', $credentials['email'], true); Artisan::call('migrate', ['--force' => 'true']); $admin = User::createAdmin($credentials); Auth::login($admin, true); $this->writeLock(); }