DispatchSiteMessages.php 566 B

1234567891011121314151617
  1. <?php
  2. namespace App\Console\Commands;
  3. use App\Services\SiteMessageService;
  4. use Illuminate\Console\Command;
  5. class DispatchSiteMessages extends Command
  6. {
  7. protected $signature = 'messages:dispatch';
  8. protected $description = 'Deliver due internal messages to snapshotted recipients using their saved languages';
  9. public function handle(SiteMessageService $service): int
  10. {
  11. $result = $service->dispatchDue(); $this->line(json_encode($result, JSON_UNESCAPED_UNICODE));
  12. return $result['failed'] > 0 ? self::FAILURE : self::SUCCESS;
  13. }
  14. }