LaravelFormTemplateServiceProvider::boot()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.9332
c 0
b 0
f 0
cc 2
nc 2
nop 0
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