Completed
Pull Request — master (#11)
by
unknown
01:41
created

AuthServiceProvider   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
dl 0
loc 28
rs 10
c 0
b 0
f 0
wmc 1
lcom 1
cbo 4

1 Method

Rating   Name   Duplication   Size   Complexity  
A boot() 0 8 1
1
<?php
2
3
namespace Microboard\Providers;
4
5
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
6
use Illuminate\Contracts\Auth\Access\Gate as GateContract;
7
use Microboard\Models\User;
8
9
class AuthServiceProvider extends ServiceProvider
10
{
11
    /**
12
     * The policy mappings for the application.
13
     *
14
     * @var array
15
     */
16
    protected $policies = [
17
        'App\User' => 'Microboard\Policies\UserPolicy',
18
        'Microboard\Models\Role' => 'Microboard\Policies\RolePolicy',
19
        'Microboard\Models\Setting' => 'Microboard\Policies\SettingPolicy',
20
    ];
21
22
    /**
23
     * Register any authentication / authorization services.
24
     *
25
     * @param GateContract $gate
26
     * @return void
27
     */
28
    public function boot(GateContract $gate)
29
    {
30
        $this->registerPolicies();
31
32
        $gate->define('view-dashboard', function(User $user) {
33
            return $user->permissions()->contains('name', 'dashboard-viewAny');
34
        });
35
    }
36
}
37