fix pterodactyl:user command

This commit is contained in:
Jakob Schrettenbrunner 2017-09-04 23:50:21 +02:00
parent 7222754580
commit 73d153cacb
1 changed files with 13 additions and 4 deletions

View File

@ -25,7 +25,8 @@
namespace Pterodactyl\Console\Commands; namespace Pterodactyl\Console\Commands;
use Illuminate\Console\Command; use Illuminate\Console\Command;
use Pterodactyl\Repositories\oldUserRepository; use Pterodactyl\Repositories\UserRepository;
use Pterodactyl\Services\Users\UserCreationService;
class MakeUser extends Command class MakeUser extends Command
{ {
@ -49,12 +50,20 @@ class MakeUser extends Command
*/ */
protected $description = 'Create a user within the panel.'; protected $description = 'Create a user within the panel.';
/**
* @var \Pterodactyl\Services\Users\UserCreationService
*/
protected $creationService;
/** /**
* Create a new command instance. * Create a new command instance.
*/ */
public function __construct() public function __construct(
UserCreationService $creationService
)
{ {
parent::__construct(); parent::__construct();
$this->creationService = $creationService;
} }
/** /**
@ -78,8 +87,8 @@ class MakeUser extends Command
$data['root_admin'] = is_null($this->option('admin')) ? $this->confirm('Is this user a root administrator?') : $this->option('admin'); $data['root_admin'] = is_null($this->option('admin')) ? $this->confirm('Is this user a root administrator?') : $this->option('admin');
try { try {
$user = new oldUserRepository;
$user->create($data); $this->creationService->handle($data);
return $this->info('User successfully created.'); return $this->info('User successfully created.');
} catch (\Exception $ex) { } catch (\Exception $ex) {