ChuckConfigServiceProvider   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Importance

Changes 2
Bugs 2 Features 0
Metric Value
eloc 20
c 2
b 2
f 0
dl 0
loc 49
rs 10
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 31 3
A register() 0 2 1
1
<?php
2
3
namespace Chuckbe\Chuckcms\Providers;
4
5
use Chuckbe\Chuckcms\Models\Site;
6
use ChuckSite;
0 ignored issues
show
Bug introduced by
The type ChuckSite was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
7
use Illuminate\Support\ServiceProvider;
8
use Schema;
9
10
class ChuckConfigServiceProvider extends ServiceProvider
11
{
12
    /**
13
     * Bootstrap the application services.
14
     *
15
     * @return void
16
     */
17
    public function boot()
18
    {
19
        config([
20
            'app.locale'          => 'nl',
21
            'app.fallback_locale' => 'en',
22
23
            // UniSharp/laravel-filemanager
24
            'lfm_config.url_prefix' => 'dashboard/mediacenter',
25
26
            // laravel/laravel
27
            'auth.providers.users.model' => \Chuckbe\Chuckcms\Models\User::class,
28
        ]);
29
30
        if (Schema::hasTable('sites')) {
31
            $site = Site::first();
32
        } else {
33
            $site = null;
34
        }
35
36
        if ($site !== null) {
37
            config([
38
                // mcamara/laravel-localization
39
                'laravellocalization.supportedLocales'        => ChuckSite::getSupportedLocales(),
40
                'laravellocalization.useAcceptLanguageHeader' => config('lang.useAcceptLanguageHeader'),
41
                'laravellocalization.hideDefaultLocaleInURL'  => config('lang.hideDefaultLocaleInURL'),
42
            ]);
43
        } else {
44
            config([
45
                'laravellocalization.supportedLocales'        => config('lang.supportedLocales'),
46
                'laravellocalization.useAcceptLanguageHeader' => true,
47
                'laravellocalization.hideDefaultLocaleInURL'  => false,
48
            ]);
49
        }
50
    }
51
52
    /**
53
     * Register the application services.
54
     *
55
     * @return void
56
     */
57
    public function register()
58
    {
59
    }
60
}
61