ActivityLogServiceProvider   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 41
rs 10
c 0
b 0
f 0
wmc 3
lcom 1
cbo 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 15 2
A register() 0 12 1
1
<?php
2
3
namespace LaiVu\ActivityLog;
4
5
use Illuminate\Support\ServiceProvider;
6
use LaiVu\ActivityLog\Commands\CleanActivityLogCommand;
7
8
class ActivityLogServiceProvider extends ServiceProvider
9
{
10
    /**
11
     * Perform post-registration booting of services.
12
     *
13
     * @return void
14
     */
15
    public function boot()
16
    {
17
        $this->publishes([
18
            __DIR__.'/../config/activitylog.php' => config_path('activitylog.php'),
19
        ], 'config');
20
21
        $this->mergeConfigFrom(__DIR__.'/../config/activitylog.php', 'activitylog');
22
23
        if (! class_exists('CreateActivityLogTable')) {
24
            $timestamp = date('Y_m_d_His', time());
25
            $this->publishes([
26
                __DIR__.'/../migrations/create_activity_log_table.php.stub' => database_path("/migrations/{$timestamp}_create_activity_log_table.php"),
27
            ], 'migrations');
28
        }
29
    }
30
31
    /**
32
     * Register any package services.
33
     *
34
     * @return void
35
     */
36
    public function register()
37
    {
38
        $this->app->bind(
39
            'activitylog',
40
            ActivityLogger::class
41
        );
42
43
        $this->app->bind('command.activitylog:clean', CleanActivitylogCommand::class);
44
        $this->commands([
45
            'command.activitylog:clean',
46
        ]);
47
    }
48
}