UsersServiceProvider::boot()   A
last analyzed

Complexity

Conditions 5
Paths 16

Size

Total Lines 41
Code Lines 23

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 1
Metric Value
cc 5
eloc 23
nc 16
nop 0
dl 0
loc 41
rs 9.2408
c 2
b 0
f 1
1
<?php
2
3
namespace Sfneal\Users\Providers;
4
5
use Illuminate\Support\ServiceProvider;
6
7
class UsersServiceProvider extends ServiceProvider
8
{
9
    /**
10
     * Bootstrap any Users services.
11
     *
12
     * @return void
13
     */
14
    public function boot()
15
    {
16
        // Publish config file
17
        $this->publishes([
18
            __DIR__.'/../../config/users.php' => config_path('users.php'),
19
        ], 'config');
20
21
        // `Role` migration file
22
        if (! class_exists('CreateRoleTable')) {
23
            $this->publishes([
24
                __DIR__.'/../../database/migrations/create_role_table.php.stub' => database_path(
25
                    'migrations/'.date('Y_m_d_His', time()).'_create_role_table.php'
26
                ),
27
            ], 'migration');
28
        }
29
30
        // `Team` migration file
31
        if (! class_exists('CreateTeamTable')) {
32
            $this->publishes([
33
                __DIR__.'/../../database/migrations/create_team_table.php.stub' => database_path(
34
                    'migrations/'.date('Y_m_d_His', time()).'_create_team_table.php'
35
                ),
36
            ], 'migration');
37
        }
38
39
        // `User` migration file
40
        if (! class_exists('CreateUserTable')) {
41
            $this->publishes([
42
                __DIR__.'/../../database/migrations/create_user_table.php.stub' => database_path(
43
                    'migrations/'.date('Y_m_d_His', time()).'_create_team_table.php'
44
                ),
45
            ], 'migration');
46
        }
47
48
        // `UserNotification` migration file
49
        if (! class_exists('CreateUserNotificationTable')) {
50
            $this->publishes([
51
                __DIR__.'/../../database/migrations/create_user_notification_table.php.stub' => database_path(
52
                    'migrations/'.date('Y_m_d_His', time()).'_create_user_notification_table.php'
53
                ),
54
            ], 'migration');
55
        }
56
    }
57
58
    /**
59
     * Register any Users services.
60
     *
61
     * @return void
62
     */
63
    public function register()
64
    {
65
        // Load config file
66
        $this->mergeConfigFrom(__DIR__.'/../../config/users.php', 'users');
67
    }
68
}
69