Conditions | 2 |
Paths | 2 |
Total Lines | 15 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php namespace Anomaly\DashboardModule\Widget; |
||
22 | public function allowed() |
||
23 | { |
||
24 | /* @var UserInterface $user */ |
||
25 | if (!$user = app('auth')->user()) { |
||
26 | return $this->make([]); |
||
27 | } |
||
28 | |||
29 | return $this->filter( |
||
30 | function ($widget) use ($user) { |
||
31 | |||
32 | /* @var WidgetInterface $widget */ |
||
33 | return $user->hasAnyRole($widget->getAllowedRoles()); |
||
34 | } |
||
35 | ); |
||
36 | } |
||
37 | |||
85 |