RateableServiceProvider::boot()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 0
dl 0
loc 12
rs 9.8666
c 0
b 0
f 0
1
<?php
2
3
namespace Yoeunes\Rateable;
4
5
use Yoeunes\Rateable\Services\Raty;
6
use Illuminate\Support\ServiceProvider;
7
8
class RateableServiceProvider extends ServiceProvider
9
{
10
    /**
11
     * Bootstrap the application events.
12
     */
13
    public function boot()
14
    {
15
        $this->publishes([
16
            __DIR__.'/../config/rateable.php' => config_path('rateable.php'),
17
        ], 'config');
18
19
        if (! class_exists('CreateRatingsTable')) {
20
            $this->publishes([
21
                __DIR__.'/../migrations/create_ratings_table.php' => database_path('migrations/'.date('Y_m_d_His', time()).'_create_ratings_table.php'),
22
            ], 'migrations');
23
        }
24
    }
25
26
    /**
27
     * Register the service provider.
28
     */
29
    public function register()
30
    {
31
        $this->mergeConfigFrom(__DIR__.'/../config/rateable.php', 'rateable');
32
33
        $this->app->bind('raty', function () {
34
            return new Raty();
35
        });
36
    }
37
}
38