Completed
Branch master (e25020)
by Richan
03:06
created

ServiceProvider::boot()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 14
c 0
b 0
f 0
rs 9.4285
cc 1
eloc 10
nc 1
nop 0
1
<?php
2
3
namespace RichanFongdasen\I18n;
4
5
use Illuminate\Support\ServiceProvider as Provider;
6
7
class ServiceProvider extends Provider
8
{
9
    /**
10
     * Bootstrap the application services.
11
     *
12
     * @return void
13
     */
14
    public function boot()
15
    {
16
        $this->publishes([
17
            realpath(__DIR__.'/../config/i18n.php') => config_path('i18n.php'),
18
        ], 'config');
19
20
        $this->publishes([
21
            realpath(__DIR__.'/../database/migrations/') => database_path('migrations'),
22
        ], 'migrations');
23
24
        $this->publishes([
25
            realpath(__DIR__.'/../storage/i18n/') => storage_path('i18n'),
26
        ], 'languages.json');
27
    }
28
29
    /**
30
     * Register the application services.
31
     *
32
     * @return void
33
     */
34
    public function register()
35
    {
36
        $this->mergeConfigFrom(realpath(__DIR__.'/../config/i18n.php'), 'i18n');
37
38
        $this->app->singleton(I18nService::class, function () {
39
            return new I18nService(request());
40
        });
41
    }
42
}
43