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