Completed
Pull Request — master (#9)
by
unknown
01:30
created

AuthServiceProvider::boot()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 8
rs 10
c 0
b 0
f 0
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