| 12345678910111213141516171819 |
- <?php
- namespace App\Console\Commands;
- use App\Services\Sharing\BetFactSynchronizer;
- use Illuminate\Console\Command;
- class SyncShareFacts extends Command
- {
- protected $signature = 'share:sync-facts {--from= : UTC+8 original betting date Y-m-d} {--to= : UTC+8 original betting date Y-m-d} {--write : Persist facts; default is read-only preview}';
- protected $description = 'Preview or synchronize current real betting facts for the sharing system';
- public function handle(BetFactSynchronizer $synchronizer): int
- {
- $result = $synchronizer->sync($this->option('from') ?: null, $this->option('to') ?: null, (bool) $this->option('write'));
- $this->line(json_encode($result, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR));
- return $result['errors'] === [] ? self::SUCCESS : self::FAILURE;
- }
- }
|