AppServiceProvider::boot()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1.0046

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 5
cts 6
cp 0.8333
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 0
crap 1.0046
1
<?php
2
3
namespace App\Providers;
4
5
use App\Link;
6
use Barryvdh\Debugbar\ServiceProvider as DebugbarServiceProvider;
7
use Illuminate\Support\Facades\Route;
8
use Illuminate\Support\Facades\Schema;
9
use Illuminate\Support\ServiceProvider;
10
use Laravel\Dusk\DuskServiceProvider;
11
12
class AppServiceProvider extends ServiceProvider
13
{
14
    /**
15
     * Bootstrap any application services.
16
     *
17
     * @return void
18
     */
19 12
    public function boot()
20
    {
21 12
        Schema::defaultStringLength(191);
22
23 12
        Route::bind('link_hash', function ($hash = '') {
24
            return Link::where('hash', $hash)->first();
25 12
        });
26 12
    }
27
28
    /**
29
     * Register any application services.
30
     *
31
     * @return void
32
     */
33 12
    public function register()
34
    {
35 12
        if ($this->app->environment('local', 'testing')) {
36 12
            $this->app->register(DuskServiceProvider::class);
37 12
            $this->app->register(DebugbarServiceProvider::class);
38 6
        }
39 12
    }
40
}
41