Completed
Push — develop ( 9259d7...818a8c )
by Abdelrahman
01:45
created

AdminareaPolicy   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 17
rs 10
wmc 1
lcom 0
cbo 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A access() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Cortex\Fort\Policies;
6
7
use Rinvex\Fort\Models\User;
8
use Illuminate\Auth\Access\HandlesAuthorization;
9
10
class AdminareaPolicy
11
{
12
    use HandlesAuthorization;
13
14
    /**
15
     * Determine whether the user can access the adminarea.
16
     *
17
     * @param string                   $ability
18
     * @param \Rinvex\Fort\Models\User $user
19
     *
20
     * @return bool
21
     */
22
    public function access($ability, User $user): bool
23
    {
24
        return $user->allAbilities->pluck('slug')->contains($ability);
25
    }
26
}
27