Completed
Push — master ( d1c093...e91f39 )
by Nick
05:04
created

LaravelRequestServiceProvider   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 1
Bugs 1 Features 0
Metric Value
wmc 3
c 1
b 1
f 0
lcom 1
cbo 1
dl 0
loc 35
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 16 2
A register() 0 5 1
1
<?php
2
3
namespace LaravelRequest;
4
5
use Illuminate\Support\ServiceProvider;
6
use LaravelRequest\Middleware\LogAfterRequest;
7
8
class LaravelRequestServiceProvider extends ServiceProvider
9
{
10
    /**
11
     * Bootstrap the application services.
12
     *
13
     * @return void
14
     */
15
    public function boot()
16
    {
17
      $this->publishes([
18
           __DIR__.'/../resources/config/laravel-request.php' => config_path('laravel-request.php'),
19
       ], 'config');
20
21
        //
22
        if (!class_exists('CreateRequestsTable')) {
23
            // Publish the migration
24
            $timestamp = date('Y_m_d_His', time());
25
            $this->publishes([
26
                __DIR__.'/../resources/migrations/create_requests_table.stub' => database_path('migrations/'.$timestamp.'_create_requests_table.php'),
27
            ], 'migrations');
28
        }
29
30
    }
31
32
    /**
33
     * Register the application services.
34
     *
35
     * @return void
36
     */
37
    public function register()
38
    {
39
        //
40
        $this->app['router']->middleware('log_after_request', LogAfterRequest::class);
41
    }
42
}
43