ProductServiceProvider   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 5
eloc 12
dl 0
loc 51
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 5 2
A bootForConsole() 0 11 1
A provides() 0 3 1
A register() 0 3 1
1
<?php
2
3
namespace Ronmrcdo\Inventory;
4
5
use Illuminate\Support\ServiceProvider;
6
7
class ProductServiceProvider extends ServiceProvider
8
{
9
	/**
10
	 * Boot the configurations
11
	 * 
12
	 * @return void
13
	 */
14
	public function boot(): void
15
	{
16
		// Publishing is only necessary when using the CLI.
17
        if ($this->app->runningInConsole()) {
18
            $this->bootForConsole();
19
        }
20
	}
21
22
	/**
23
	 * Register the configurations
24
	 * 
25
	 * @return void
26
	 */
27
	public function register(): void
28
	{
29
		$this->mergeConfigFrom(__DIR__.'/../config/laravel-inventory.php', 'laravel-inventory');
30
	}
31
32
	/**
33
     * Get the services provided by the provider.
34
     *
35
     * @return array
36
     */
37
    public function provides()
38
    {
39
        return ['inventory'];
40
    }
41
42
	/**
43
	 * Register the bootable configurations
44
	 * 
45
	 * @return void
46
	 */
47
	protected function bootForConsole(): void
48
	{
49
		$this->publishes([
50
            __DIR__.'/../config/laravel-inventory.php' => base_path('config/laravel-inventory.php'),
51
		], 'config');
52
		
53
		$this->loadMigrationsFrom(__DIR__.'/../database/migrations');
54
55
		$this->publishes([
56
            __DIR__.'/../database/migrations' => database_path('migrations')
57
        ], 'migrations');
58
	}
59
}