LaravelFormTemplateServiceProvider   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 10 2
A register() 0 14 1
1
<?php
2
3
namespace SoufieneSlimi\LaravelFormTemplate;
4
5
use Illuminate\Support\ServiceProvider;
6
use SoufieneSlimi\LaravelFormTemplate\Models\Template;
7
8
class LaravelFormTemplateServiceProvider extends ServiceProvider
9
{
10
    /**
11
     * Bootstrap the application services.
12
     */
13
    public function boot()
14
    {
15
        $this->loadMigrationsFrom(__DIR__.'/../database/migrations');
16
17
        if ($this->app->runningInConsole()) {
18
            $this->publishes([
19
                __DIR__.'/../config/config.php' => config_path('laravel-form-template.php'),
20
            ], 'config');
21
        }
22
    }
23
24
    /**
25
     * Register the application services.
26
     */
27
    public function register()
28
    {
29
        // Automatically apply the package configuration
30
        $this->mergeConfigFrom(__DIR__.'/../config/config.php', 'laravel-form-template');
31
32
        // Register the main class to use with the model
33
        $this->app->singleton('laravel-form-template', function () {
34
            return new Template;
35
        });
36
37
        // register their aliases
38
        $loader = \Illuminate\Foundation\AliasLoader::getInstance();
39
        $loader->alias('Template', \SoufieneSlimi\LaravelFormTemplate\Models\Template::class);
40
    }
41
}
42