VeriFactuServiceProvider::boot()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 16
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 8
c 2
b 0
f 0
dl 0
loc 16
rs 10
cc 3
nc 3
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Squareetlabs\VeriFactu\Providers;
6
7
use Illuminate\Support\ServiceProvider;
8
9
class VeriFactuServiceProvider extends ServiceProvider
10
{
11
    /**
12
     * Register services.
13
     */
14
    public function register(): void
15
    {
16
        // Registrar bindings, singletons, etc.
17
        $this->mergeConfigFrom(__DIR__ . '/../../config/verifactu.php', 'verifactu');
18
    }
19
20
    /**
21
     * Bootstrap services.
22
     */
23
    public function boot(): void
24
    {
25
        if ($this->app->runningInConsole()) {
26
            // Publicar archivos de configuración
27
            $this->publishes([
28
                __DIR__ . '/../../config/verifactu.php' => config_path('verifactu.php'),
29
            ], 'verifactu-config');
30
31
            // Publicar migraciones solo si está habilitado en config
32
            if (config('verifactu.load_migrations', false)) {
33
                $this->loadMigrationsFrom(__DIR__ . '/../../database/migrations');
34
            }
35
36
            // Registrar comandos
37
            $this->commands([
38
                \Squareetlabs\VeriFactu\Console\Commands\MakeAdapterCommand::class,
39
            ]);
40
        }
41
    }
42
}