MultiStepFormsServiceProvider   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 4
dl 0
loc 44
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 24 3
A register() 0 10 1
1
<?php
2
3
namespace Infinitypaul\MultiStep;
4
5
use Illuminate\Support\Facades\Route;
6
use Illuminate\Support\ServiceProvider;
7
use Infinitypaul\MultiStep\Controller\MultiStepManager;
8
use Infinitypaul\MultiStep\Routing\PendingMultiStepRegister;
9
10
class MultiStepFormsServiceProvider extends ServiceProvider
11
{
12
    /**
13
     * Bootstrap the application services.
14
     */
15
    public function boot()
16
    {
17
18
        //$this->loadRoutesFrom(__DIR__.'/routes.php');
19
20
        Route::macro('multistep', function ($uri, $controller) {
21
            return new  PendingMultiStepRegister($uri, $controller);
22
        });
23
24
        if ($this->app->runningInConsole()) {
25
            $this->publishes([
26
                __DIR__.'/../config/steps.php' => config_path('steps.php'),
27
            ], 'config');
28
29
            if (! class_exists('CreateMultiStepsTable')) {
30
                $this->publishes([
31
                    __DIR__.'/../database/migrations/create_multisteps_table.php.stub' => database_path('migrations/'.date('Y_m_d_His', time()).'_create_multisteps_table.php'),
32
                ], 'migrations');
33
            }
34
35
            // Registering package commands.
36
            // $this->commands([]);
37
        }
38
    }
39
40
    /**
41
     * Register the application services.
42
     */
43
    public function register()
44
    {
45
        // Automatically apply the package configuration
46
        $this->mergeConfigFrom(__DIR__.'/../config/steps.php', 'steps');
47
48
        // Register the main class to use with the facade
49
        $this->app->singleton('laravel-multistep-forms', function ($app) {
50
            return new MultiStepManager($app);
51
        });
52
    }
53
}
54