Conditions | 3 |
Paths | 1 |
Total Lines | 16 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
23 | public function handle(Request $request, Closure $next) |
||
24 | { |
||
25 | // Bypass authorization check if superadmin |
||
26 | Gate::before(function (User $user) { |
||
27 | return $user->isSuperadmin() ?: null; |
||
28 | }); |
||
29 | |||
30 | // Define abilities and policies |
||
31 | app('rinvex.fort.ability')->all()->map(function ($ability) { |
||
32 | Gate::define($ability->slug, $ability->policy ?: function (User $user, Model $resource = null) use ($ability) { |
||
33 | return $user->allAbilities->pluck('slug')->contains($ability->slug); |
||
34 | }); |
||
35 | }); |
||
36 | |||
37 | return $next($request); |
||
38 | } |
||
39 | } |
||
40 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.