Browse Source

支持 notification

visuddhinanda 2 năm trước cách đây
mục cha
commit
7d614b47cb
1 tập tin đã thay đổi với 10 bổ sung3 xóa
  1. 10 3
      app/Console/Commands/TestMq.php

+ 10 - 3
app/Console/Commands/TestMq.php

@@ -3,20 +3,22 @@
 namespace App\Console\Commands;
 namespace App\Console\Commands;
 
 
 use Illuminate\Console\Command;
 use Illuminate\Console\Command;
+use Illuminate\Support\Str;
 
 
 use App\Http\Api\Mq;
 use App\Http\Api\Mq;
 use App\Models\Discussion;
 use App\Models\Discussion;
 use App\Http\Resources\DiscussionResource;
 use App\Http\Resources\DiscussionResource;
-use Illuminate\Support\Str;
+use App\Models\SentPr;
+use App\Http\Resources\SentPrResource;
 
 
 class TestMq extends Command
 class TestMq extends Command
 {
 {
     /**
     /**
      * The name and signature of the console command.
      * The name and signature of the console command.
-     *
+     * php artisan test:mq
      * @var string
      * @var string
      */
      */
-    protected $signature = 'test:mq {--discussion=}';
+    protected $signature = 'test:mq {--discussion=} {--pr=}';
 
 
     /**
     /**
      * The console command description.
      * The console command description.
@@ -51,6 +53,11 @@ class TestMq extends Command
             Mq::publish('discussion',new DiscussionResource(Discussion::find($discussion)));
             Mq::publish('discussion',new DiscussionResource(Discussion::find($discussion)));
         }
         }
 
 
+        $pr = $this->option('pr');
+        if($pr && Str::isUuid($pr)){
+            Mq::publish('suggestion',new SentPrResource(SentPr::where('uid',$pr)->first()));
+        }
+
         return 0;
         return 0;
     }
     }
 }
 }