소스 검색

Merge pull request #4067 from idanoo/dev

Update User artisan commands to match UserDelete
daniel 2 년 전
부모
커밋
0269e4d0e8
4개의 변경된 파일20개의 추가작업 그리고 4개의 파일을 삭제
  1. 5 1
      app/Console/Commands/UserAdmin.php
  2. 5 1
      app/Console/Commands/UserShow.php
  3. 5 1
      app/Console/Commands/UserSuspend.php
  4. 5 1
      app/Console/Commands/UserUnsuspend.php

+ 5 - 1
app/Console/Commands/UserAdmin.php

@@ -39,7 +39,11 @@ class UserAdmin extends Command
     public function handle()
     {
         $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) {
             $this->error('Could not find any user with that username or id.');
             exit;

+ 5 - 1
app/Console/Commands/UserShow.php

@@ -39,7 +39,11 @@ class UserShow extends Command
     public function handle()
     {
         $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) {
             $this->error('Could not find any user with that username or id.');
             exit;

+ 5 - 1
app/Console/Commands/UserSuspend.php

@@ -39,7 +39,11 @@ class UserSuspend extends Command
     public function handle()
     {
         $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) {
             $this->error('Could not find any user with that username or id.');
             exit;

+ 5 - 1
app/Console/Commands/UserUnsuspend.php

@@ -39,7 +39,11 @@ class UserUnsuspend extends Command
     public function handle()
     {
         $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) {
             $this->error('Could not find any user with that username or id.');
             exit;