Completed
Push — master ( d68ab4...0c873a )
by Anılcan
01:29
created

FormerServiceProvider::boot()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 4
rs 10
c 1
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace AnilcanCakir\Former;
4
5
use AnilcanCakir\Former\Contracts\Form\Factory;
6
use Illuminate\Support\ServiceProvider;
7
8
class FormerServiceProvider extends ServiceProvider
9
{
10
    /**
11
     * Bootstrap any application services.
12
     *
13
     * @return void
14
     */
15
    public function boot()
16
    {
17
        $this->registerResources();
18
    }
19
20
    /**
21
     * Register the Former resources.
22
     *
23
     * @return void
24
     */
25
    protected function registerResources()
26
    {
27
        $this->loadViewsFrom(__DIR__.'/../resources/views', 'former');
28
    }
29
30
    /**
31
     * Register the service provider.
32
     *
33
     * @return void
34
     */
35
    public function register()
36
    {
37
        $this->configure();
38
        $this->registerFactories();
39
    }
40
41
    /**
42
     * Setup the configuration for Former.
43
     *
44
     * @return void
45
     */
46
    protected function configure()
47
    {
48
        $this->mergeConfigFrom(
49
            __DIR__.'/../config/former.php', 'former'
50
        );
51
    }
52
53
    /**
54
     * Register the factories for Former.
55
     *
56
     * @return void
57
     */
58
    protected function registerFactories()
59
    {
60
        $this->app->singleton(Factory::class, function ($app) {
61
            return new FormFactory($app['view'], $app['translator'], $app['config']);
62
        });
63
    }
64
}
65