diff --git a/app/Console/Commands/createUser.php b/app/Console/Commands/createUser.php new file mode 100644 index 00000000..dfed3a79 --- /dev/null +++ b/app/Console/Commands/createUser.php @@ -0,0 +1,73 @@ +option('ptero_id') ?? $this->ask('Please specify your Pterodactyl ID.'); + + $password = $this->option('password') ?? $this->ask('Please specify your password.'); + + $response = Pterodactyl::getUser($ptero_id); + + + if (is_null($response)) { + print_r('It seems that your Pterodactyl ID isnt correct. Rerun the command and input an correct ID'); + + return; + }; + + $user = User::create([ + 'name' => $response['first_name'], + 'email' => $response['email'], + 'role' => 'admin', + 'password' => Hash::make($password), + 'pterodactyl_id' => $response['id'] + ]); + + $this->table(['Field', 'Value'], [ + ['ID', $user->id], + ['Email', $user->email], + ['Username', $user->name], + ['Ptero-ID', $user->pterodactyl_id], + ['Admin', $user->role], + ]); + } +}