| @@ 31-40 (lines=10) @@ | ||
| 28 | $anyScopeMiddleware = collect($middlewares)->first(function($item) { |
|
| 29 | return preg_match('/^scope:/', $item); |
|
| 30 | }); |
|
| 31 | if ($anyScopeMiddleware) { |
|
| 32 | $scopes = explode(',', preg_replace('/^scope:/', '', $anyScopeMiddleware)); |
|
| 33 | $scopesInfo = Passport::scopes()->filter(function($item) use($scopes) { |
|
| 34 | return in_array($item->id, $scopes); |
|
| 35 | })->values(); |
|
| 36 | return [ |
|
| 37 | 'type' => 'any', |
|
| 38 | 'scopes' => $scopesInfo |
|
| 39 | ]; |
|
| 40 | } |
|
| 41 | $allScopeMiddleware = collect($middlewares)->first(function($item) { |
|
| 42 | return preg_match('/^scopes:/', $item); |
|
| 43 | }); |
|
| @@ 44-53 (lines=10) @@ | ||
| 41 | $allScopeMiddleware = collect($middlewares)->first(function($item) { |
|
| 42 | return preg_match('/^scopes:/', $item); |
|
| 43 | }); |
|
| 44 | if ($allScopeMiddleware) { |
|
| 45 | $scopes = explode(',', preg_replace('/^scopes:/', '', $allScopeMiddleware)); |
|
| 46 | $scopesInfo = Passport::scopes()->filter(function($item) use($scopes) { |
|
| 47 | return in_array($item->id, $scopes); |
|
| 48 | })->values(); |
|
| 49 | return [ |
|
| 50 | 'type' => 'all', |
|
| 51 | 'scopes' => $scopesInfo |
|
| 52 | ]; |
|
| 53 | } |
|
| 54 | return null; |
|
| 55 | } |
|
| 56 | ||