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 Illuminate\Console\Command;
7use Illuminate\Support\Facades\Log;
8
9class IfexQuotationsSync extends Command
10{
11    /**
12     * The name and signature of the console command.
13     *
14     * @var string
15     */
16    protected $signature = 'ifex-quotations:sync';
17
18    /**
19     * The console command description.
20     *
21     * @var string
22     */
23    protected $description = 'Synchronizes IFEX budgets';
24
25    /**
26     * The PresupuestoService instance.
27     *
28     * @var IfexController
29     */
30    protected $ifexController;
31
32    /**
33     * Create a new command instance.
34     *
35     * @return void
36     */
37    public function __construct(IfexController $ifexController)
38    {
39        parent::__construct();
40        $this->ifexController = $ifexController;
41    }
42
43    /**
44     * Execute the console command.
45     *
46     * @return int
47     */
48    public function handle()
49    {
50        try {
51            $this->ifexController->syncQuotations();
52
53            return Command::SUCCESS;
54        } catch (\Exception $e) {
55            Log::channel('g3w')->error('Synchronization failed for ifex update, Error: '.$e->getMessage());
56
57            return Command::FAILURE;
58        }
59    }
60}