Completed
Push — master ( c43b41...e9ce87 )
by Felix
10s
created

ServiceProvider   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 14 1
A register() 0 4 1
1
<?php namespace Felixkiss\UniqueWithValidator;
2
3
use Illuminate\Support\ServiceProvider as BaseServiceProvider;
4
5
class ServiceProvider extends BaseServiceProvider
6
{
7
    /**
8
     * Bootstrap the application events.
9
     *
10
     * @return void
11
     */
12
    public function boot()
13
    {
14
        $this->loadTranslationsFrom(
15
            __DIR__ . '/../../lang',
16
            'uniquewith-validator'
17
        );
18
19
        $message = $this->app->translator->trans('uniquewith-validator::validation.unique_with');
20
        $this->app->validator->extend('unique_with', Validator::class . '@validateUniqueWith', $message);
21
        $this->app->validator->replacer('unique_with', function() {
22
            $translator = $this->app->translator;
23
            return call_user_func_array([new Validator, 'replaceUniqueWith'], array_merge(func_get_args(), [$translator]));
24
        });
25
    }
26
27
    /**
28
     * Register the service provider.
29
     *
30
     * @return void
31
     */
32
    public function register()
33
    {
34
35
    }
36
}
37