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