Passed
Push — dev5a ( 646bdc...a81ef3 )
by Ron
07:34
created

SettingsServiceProvider   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Test Coverage

Coverage 85.71%

Importance

Changes 4
Bugs 0 Features 0
Metric Value
eloc 5
c 4
b 0
f 0
dl 0
loc 26
ccs 6
cts 7
cp 0.8571
rs 10
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 8 3
A boot() 0 2 1
1
<?php
2
3
namespace App\Providers;
4
5
use Config;
6
7
use Illuminate\Support\Facades\DB;
8
use Illuminate\Support\Facades\Schema;
9
use Illuminate\Support\ServiceProvider;
10
11
class SettingsServiceProvider extends ServiceProvider
12
{
13
    /**
14
     * Register services.
15
     *
16
     * @return void
17
     */
18 516
    public function register()
19
    {
20 516
        if(Schema::hasTable('settings'))
21
        {
22 516
            $settings = DB::table('settings')->get();
23 516
            foreach($settings as $setting)
24
            {
25
                Config([$setting->key => $setting->value]);
26
            }
27
        }
28 516
    }
29
30
    /**
31
     * Bootstrap services.
32
     *
33
     * @return void
34
     */
35 516
    public function boot()
36
    {
37
        //
38 516
    }
39
}
40