Conditions | 5 |
Paths | 4 |
Total Lines | 12 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
39 | function hasPermission($routeName, $withAcl, $withPolicy = false, $entity = []) { |
||
40 | $showButton = true; |
||
41 | |||
42 | if ($withAcl) { |
||
43 | if (!auth()->user()->hasPermission($routeName)) { |
||
44 | $showButton = false; |
||
45 | } else if ($withPolicy && !auth()->user()->hasPermission($routeName, $entity)) { |
||
46 | $showButton = false; |
||
47 | } |
||
48 | } |
||
49 | |||
50 | return $showButton; |
||
51 | } |
||
53 |