Completed
Push — master ( 328857...405b9d )
by Basenko
03:28
created

SeoableServiceProvider::boot()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 11
ccs 6
cts 6
cp 1
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 5
nc 2
nop 0
crap 2
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 9
    public function boot()
13
    {
14 9
        if ($this->app->runningInConsole()) {
15 9
            $this->publishResources();
16
        }
17
18
        // Translations
19 9
        $this->loadTranslationsFrom(__DIR__.'/../resources/lang', 'seoable');
20
21 9
        $this->app->register(\Artesaos\SEOTools\Providers\SEOToolsServiceProvider::class);
22 9
    }
23
24
    /**
25
     * Register the application services.
26
     */
27 9
    public function register()
28
    {
29 9
        $this->mergeConfigFrom(__DIR__.'/../config/seoable.php', 'seoable');
30 9
    }
31
32 9
    protected function publishResources()
33
    {
34
        // Config
35 9
        $this->publishes([
36 9
            __DIR__.'/../config/seoable.php' => config_path('seoable.php'),
37 9
        ], 'config');
38
39
        // Database
40 9
        if (! class_exists('CreateSeoTable')) {
41
            // Publish the migration
42 3
            $timestamp = date('Y_m_d_His', time());
43 3
            $this->publishes([
44 3
                __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 3
            ], 'migrations');
46
        }
47
48 9
        $this->publishes([
49 9
            __DIR__.'/../resources/lang' => resource_path('lang/vendor/seoable'),
50 9
        ], 'lang');
51 9
    }
52
}
53