Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 7 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
| SincronizarPresupuestos | |
0.00% |
0 / 7 |
|
0.00% |
0 / 2 |
12 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
| handle | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
6 | |||
| 1 | <?php |
| 2 | namespace App\Console\Commands; |
| 3 | |
| 4 | use Illuminate\Console\Command; |
| 5 | use App\Services\PresupuestosService; |
| 6 | |
| 7 | class SincronizarPresupuestos extends Command |
| 8 | { |
| 9 | protected $signature = 'presupuestos:sincronizar {fecha?}'; |
| 10 | protected $description = 'Sincroniza los presupuestos con Gestiona.'; |
| 11 | protected $presupuestosService; |
| 12 | |
| 13 | public function __construct(PresupuestosService $presupuestosService) |
| 14 | { |
| 15 | parent::__construct(); |
| 16 | $this->presupuestosService = $presupuestosService; |
| 17 | } |
| 18 | |
| 19 | public function handle() |
| 20 | { |
| 21 | $fecha = $this->argument('fecha') ?? now()->toDateString(); |
| 22 | $result = $this->presupuestosService->syncByDate($fecha); |
| 23 | |
| 24 | if ($result['success']) { |
| 25 | $this->info($result['message']); |
| 26 | } else { |
| 27 | $this->error($result['error']); |
| 28 | } |
| 29 | } |
| 30 | } |