Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 9 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
| QuotationsRetryFailed | |
0.00% |
0 / 9 |
|
0.00% |
0 / 2 |
12 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
| handle | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
6 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Console\Commands; |
| 4 | |
| 5 | use App\Services\PresupuestosService; |
| 6 | use Illuminate\Console\Command; |
| 7 | use Illuminate\Support\Facades\Log; |
| 8 | |
| 9 | class QuotationsRetryFailed extends Command |
| 10 | { |
| 11 | /** |
| 12 | * The name and signature of the console command. |
| 13 | * |
| 14 | * @var string |
| 15 | */ |
| 16 | protected $signature = 'quotations:retry-failed {name?} {region?}'; |
| 17 | |
| 18 | /** |
| 19 | * The console command description. |
| 20 | * |
| 21 | * @var string |
| 22 | */ |
| 23 | protected $description = 'Synchronizes budgets for that failed'; |
| 24 | |
| 25 | protected $presupuestoService; |
| 26 | |
| 27 | /** |
| 28 | * @var mixed |
| 29 | */ |
| 30 | private $presupuestosService; |
| 31 | |
| 32 | /** |
| 33 | * Create a new command instance. |
| 34 | * |
| 35 | * @return void |
| 36 | */ |
| 37 | public function __construct(PresupuestosService $presupuestosService) |
| 38 | { |
| 39 | parent::__construct(); |
| 40 | $this->presupuestosService = $presupuestosService; |
| 41 | } |
| 42 | |
| 43 | /** |
| 44 | * Execute the console command. |
| 45 | * |
| 46 | * @return int |
| 47 | */ |
| 48 | public function handle() |
| 49 | { |
| 50 | $name = $this->argument('name') ?? 'System'; |
| 51 | $region = $this->argument('region') ?? null; |
| 52 | try { |
| 53 | $result = $this->presupuestosService->syncErrorBudgets($name, $region); |
| 54 | |
| 55 | return Command::SUCCESS; |
| 56 | } catch (\Exception $e) { |
| 57 | Log::channel('g3w')->error('Synchronization of failed budgets failed, Error: '.$e->getMessage()); |
| 58 | |
| 59 | return Command::FAILURE; |
| 60 | } |
| 61 | } |
| 62 | } |