Update User artisan commands to match UserDelete

pull/4067/head
idanoo 2023-01-08 11:34:10 +13:00
rodzic 71cc016e0b
commit 52d65538cd
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 387387CDBC02F132
4 zmienionych plików z 20 dodań i 4 usunięć

Wyświetl plik

@ -39,7 +39,11 @@ class UserAdmin extends Command
public function handle() public function handle()
{ {
$id = $this->argument('id'); $id = $this->argument('id');
$user = User::whereUsername($id)->orWhere('id', $id)->first(); if(ctype_digit($id) == true) {
$user = User::find($id);
} else {
$user = User::whereUsername($id)->first();
}
if(!$user) { if(!$user) {
$this->error('Could not find any user with that username or id.'); $this->error('Could not find any user with that username or id.');
exit; exit;

Wyświetl plik

@ -39,7 +39,11 @@ class UserShow extends Command
public function handle() public function handle()
{ {
$id = $this->argument('id'); $id = $this->argument('id');
$user = User::whereUsername($id)->orWhere('id', $id)->first(); if(ctype_digit($id) == true) {
$user = User::find($id);
} else {
$user = User::whereUsername($id)->first();
}
if(!$user) { if(!$user) {
$this->error('Could not find any user with that username or id.'); $this->error('Could not find any user with that username or id.');
exit; exit;

Wyświetl plik

@ -39,7 +39,11 @@ class UserSuspend extends Command
public function handle() public function handle()
{ {
$id = $this->argument('id'); $id = $this->argument('id');
$user = User::whereUsername($id)->orWhere('id', $id)->first(); if(ctype_digit($id) == true) {
$user = User::find($id);
} else {
$user = User::whereUsername($id)->first();
}
if(!$user) { if(!$user) {
$this->error('Could not find any user with that username or id.'); $this->error('Could not find any user with that username or id.');
exit; exit;

Wyświetl plik

@ -39,7 +39,11 @@ class UserUnsuspend extends Command
public function handle() public function handle()
{ {
$id = $this->argument('id'); $id = $this->argument('id');
$user = User::whereUsername($id)->orWhere('id', $id)->first(); if(ctype_digit($id) == true) {
$user = User::find($id);
} else {
$user = User::whereUsername($id)->first();
}
if(!$user) { if(!$user) {
$this->error('Could not find any user with that username or id.'); $this->error('Could not find any user with that username or id.');
exit; exit;