RallyServiceProvider::setupConfig()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 9
ccs 0
cts 7
cp 0
rs 9.6666
c 0
b 0
f 0
cc 1
eloc 6
nc 1
nop 0
crap 2
1
<?php
2
3
/*
4
 * This file is part of questocat/laravel-rally package.
5
 *
6
 * (c) questocat <[email protected]>
7
 *
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
namespace Questocat\Rally;
13
14
use Illuminate\Support\ServiceProvider;
15
16
class RallyServiceProvider extends ServiceProvider
17
{
18
    /**
19
     * Indicates if loading of the provider is deferred.
20
     *
21
     * @var bool
22
     */
23
    protected $defer = false;
24
25
    /**
26
     * Bootstrap the application events.
27
     */
28
    public function boot()
29
    {
30
        $this->setupConfig();
31
        $this->setupMigrations();
32
    }
33
34
    /**
35
     * {@inheritdoc}
36
     */
37
    public function register()
38
    {
39
    }
40
41
    /**
42
     * Setup the config.
43
     */
44
    protected function setupConfig()
45
    {
46
        $source = realpath(__DIR__.'/../config/rally.php');
47
        $this->publishes([
48
            $source => config_path('rally.php'),
49
        ], 'config');
50
51
        $this->mergeConfigFrom($source, 'rally');
52
    }
53
54
    /**
55
     * Setup the migrations.
56
     */
57
    protected function setupMigrations()
58
    {
59
        $timestamp = date('Y_m_d_His');
60
        $migrationsSource = realpath(__DIR__.'/../database/migrations/create_followables_table.php');
61
        $migrationsTarget = database_path("/migrations/{$timestamp}_create_followables_table.php");
62
        $this->publishes([
63
            $migrationsSource => $migrationsTarget,
64
        ], 'migrations');
65
    }
66
}
67