LaravelCommentableServiceProvider::boot()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 11
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 1 Features 0
Metric Value
cc 3
eloc 8
c 2
b 1
f 0
nc 3
nop 0
dl 0
loc 11
rs 10
1
<?php
2
3
namespace Orkhanahmadov\LaravelCommentable;
4
5
use Illuminate\Support\ServiceProvider;
6
7
class LaravelCommentableServiceProvider extends ServiceProvider
8
{
9
    /**
10
     * Bootstrap the application services.
11
     */
12
    public function boot()
13
    {
14
        if ($this->app->runningInConsole()) {
15
            $this->publishes([
16
                __DIR__ . '/../config/config.php' => config_path('commentable.php'),
17
            ], 'config');
18
19
            if (! class_exists('CreateCommentableTable')) {
20
                $this->publishes([
21
                    __DIR__ . '/../database/migrations/commentable_table.php.stub' => database_path('migrations/' . date('Y_m_d_His', time()) . '_create_commentable_table.php'),
22
                ], 'migrations');
23
            }
24
        }
25
    }
26
27
    /**
28
     * Register the application services.
29
     */
30
    public function register()
31
    {
32
        $this->mergeConfigFrom(__DIR__ . '/../config/config.php', 'commentable');
33
    }
34
}
35