LaravelSeoMetaBoxServiceProvider   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 16
c 2
b 0
f 0
dl 0
loc 40
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 21 2
A register() 0 8 1
1
<?php
2
3
namespace Giuga\LaravelSeoMetaBox;
4
5
use Giuga\LaravelSeoMetaBox\Http\View\MetaboxComposer;
6
use Illuminate\Support\Facades\Blade;
7
use Illuminate\Support\Facades\View;
8
use Illuminate\Support\ServiceProvider;
9
10
class LaravelSeoMetaBoxServiceProvider extends ServiceProvider
11
{
12
    /**
13
     * Bootstrap the application services.
14
     */
15
    public function boot()
16
    {
17
        $this->loadViewsFrom(__DIR__.'/../resources/views', 'laravel-seo-meta-box');
18
        $this->loadMigrationsFrom(__DIR__.'/../database/migrations');
19
20
        if ($this->app->runningInConsole()) {
21
            // Publishing the config.
22
            $this->publishes([
23
                __DIR__.'/../config/config.php' => config_path('meta-box.php'),
24
            ], 'metabox-config');
25
26
            // Publishing the views.
27
            $this->publishes([
28
                __DIR__.'/../resources/views' => resource_path('views/vendor/laravel-seo-meta-box'),
29
            ], 'metabox-views');
30
        }
31
32
        Blade::include('laravel-seo-meta-box::seo', 'metabox');
33
34
        View::composer(
35
            'laravel-seo-meta-box::seo', MetaboxComposer::class
36
        );
37
    }
38
39
    /**
40
     * Register the application services.
41
     */
42
    public function register()
43
    {
44
        // Automatically apply the package configuration
45
        $this->mergeConfigFrom(__DIR__.'/../config/config.php', 'meta-box');
46
47
        // Register the main class to use with the facade
48
        $this->app->singleton('laravel-seo-meta-box', function () {
49
            return new LaravelSeoMetaBox;
50
        });
51
    }
52
}
53