AuthorizationServiceProvider::boot()   A
last analyzed

Complexity

Conditions 2
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2.032

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 4
nc 1
nop 0
dl 0
loc 8
ccs 4
cts 5
cp 0.8
crap 2.032
rs 9.4285
c 1
b 0
f 0
1
<?php namespace Arcanesoft\Core\Providers;
2
3
use Arcanedev\Support\Providers\AuthorizationServiceProvider as ServiceProvider;
4
use Arcanesoft\Contracts\Auth\Models\User;
5
use Illuminate\Support\Facades\Gate;
6
7
/**
8
 * Class     AuthorizationServiceProvider
9
 *
10
 * @package  Arcanesoft\Core\Providers
11
 * @author   ARCANEDEV <[email protected]>
12
 */
13
class AuthorizationServiceProvider extends ServiceProvider
14
{
15
    /* -----------------------------------------------------------------
16
     |  Main Methods
17
     | -----------------------------------------------------------------
18
     */
19
20
    /**
21
     * Register any application authentication / authorization services.
22
     */
23 124
    public function boot()
24
    {
25 124
        $this->registerPolicies();
26
27 124
        Gate::before(function (User $user, $ability) {
0 ignored issues
show
Unused Code introduced by
The parameter $ability is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
28
            return $user->isAdmin() ? true : null;
29 124
        });
30
    }
31
}
32