Completed
Push — master ( c840b8...cd48ac )
by Abdelrahman
02:55 queued 24s
created

RepositoryServiceProvider::register()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
3
/*
4
 * NOTICE OF LICENSE
5
 *
6
 * Part of the Rinvex Repository Package.
7
 *
8
 * This source file is subject to The MIT License (MIT)
9
 * that is bundled with this package in the LICENSE file.
10
 *
11
 * Package: Rinvex Repository Package
12
 * License: The MIT License (MIT)
13
 * Link:    https://rinvex.com
14
 */
15
16
namespace Rinvex\Repository\Providers;
17
18
use Illuminate\Support\ServiceProvider;
19
use Rinvex\Repository\Listeners\RepositoryEventListener;
20
21
class RepositoryServiceProvider extends ServiceProvider
22
{
23
    /**
24
     * {@inheritdoc}
25
     */
26
    public function register()
27
    {
28
        // Merge config
29
        $this->mergeConfigFrom(realpath(__DIR__.'/../../config/config.php'), 'rinvex.repository');
30
31
        // Register the event listener
32
        $this->app->bind('rinvex.repository.listener', RepositoryEventListener::class);
33
    }
34
35
    /**
36
     * {@inheritdoc}
37
     */
38
    public function boot()
39
    {
40
        // Publish Resources
41
        $this->publishResources();
42
43
        // Subscribe the registered event listener
44
        $this->app['events']->subscribe('rinvex.repository.listener');
45
    }
46
47
    /**
48
     * Publish resources.
49
     */
50
    protected function publishResources()
51
    {
52
        // Publish config
53
        $this->publishes([
54
            realpath(__DIR__.'/../../config/config.php') => config_path('rinvex.repository.php'),
55
        ], 'config');
56
    }
57
}
58