Completed
Push — master ( 8f5f7c...7faed5 )
by Basenko
04:23
created

SeoableServiceProvider::boot()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 1
Metric Value
dl 0
loc 11
c 2
b 0
f 1
rs 9.4285
cc 2
eloc 5
nc 2
nop 0
1
<?php
2
3
namespace MadWeb\Seoable;
4
5
use Illuminate\Support\ServiceProvider;
6
7
class SeoableServiceProvider extends ServiceProvider
8
{
9
    /**
10
     * Bootstrap the application services.
11
     */
12
    public function boot()
13
    {
14
        if ($this->app->runningInConsole()) {
15
            $this->publishResources();
16
        }
17
18
        // Translations
19
        $this->loadTranslationsFrom(__DIR__.'/../resources/lang', 'seoable');
20
21
        $this->app->register(\Artesaos\SEOTools\Providers\SEOToolsServiceProvider::class);
22
    }
23
24
    /**
25
     * Register the application services.
26
     */
27
    public function register()
28
    {
29
        $this->mergeConfigFrom(__DIR__.'/../config/seoable.php', 'seoable');
30
    }
31
32
    protected function publishResources()
33
    {
34
        // Config
35
        $this->publishes([
36
            __DIR__.'/../config/seoable.php' => config_path('seoable.php'),
37
        ], 'config');
38
39
        // Database
40
        if (! class_exists('CreateSeoTable')) {
41
            // Publish the migration
42
            $timestamp = date('Y_m_d_His', time());
43
            $this->publishes([
44
                __DIR__.'/../database/migrations/create_seo_table.php.stub' => $this->app->databasePath().'/migrations/'.$timestamp.'_create_seo_table.php',
0 ignored issues
show
Bug introduced by
The method databasePath() does not exist on Illuminate\Contracts\Foundation\Application. Did you maybe mean basePath()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
45
            ], 'migrations');
46
        }
47
48
        $this->publishes([
49
            __DIR__.'/../resources/lang' => resource_path('lang/vendor/seoable'),
50
        ], 'lang');
51
    }
52
}
53