| 12345678910111213141516171819 |
- <?php
- namespace App\Console\Commands;
- use App\Services\AutomaticRewardGrantService;
- use Illuminate\Console\Command;
- class AutoGrantRewards extends Command
- {
- protected $signature = 'rewards:auto-grant';
- protected $description = 'Grant eligible rebate/backflow rewards only when their automatic schedule is enabled and due';
- public function handle(AutomaticRewardGrantService $service): int
- {
- $result = $service->run();
- $this->line(json_encode($result, JSON_UNESCAPED_UNICODE));
- return array_sum(array_column($result, 'failed')) > 0 ? self::FAILURE : self::SUCCESS;
- }
- }
|