Conditions | 5 |
Paths | 4 |
Total Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
23 | public function handle($request, $next, ...$scopes) |
||
24 | { |
||
25 | if (! $request->user() || ! $request->user()->token()) { |
||
26 | throw new AuthenticationException(); |
||
27 | } |
||
28 | |||
29 | foreach ($scopes as $scope) { |
||
30 | if (! $request->user()->token()->abilities->map->getRouteKey()->contains($scope)) { |
||
31 | throw new MissingScopeException($scope); |
||
32 | } |
||
33 | } |
||
34 | |||
35 | return $next($request); |
||
36 | } |
||
37 | } |
||
38 |