Total Complexity | 8 |
Total Lines | 43 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
7 | class AuthConfigHelper |
||
8 | { |
||
9 | /** |
||
10 | * Get the user provider on configs. |
||
11 | * |
||
12 | * @param Authenticatable $user |
||
13 | * @return string|null |
||
14 | */ |
||
15 | 13 | public static function getUserProvider(Authenticatable $user) |
|
16 | { |
||
17 | 13 | foreach (config('auth.providers') as $provider => $config) { |
|
18 | 13 | if ($user instanceof $config['model']) { |
|
19 | 13 | return $provider; |
|
20 | } |
||
21 | } |
||
22 | 1 | } |
|
23 | |||
24 | /** |
||
25 | * Get the guard of specific provider to `passport` driver. |
||
26 | * |
||
27 | * @param string $provider |
||
28 | * @return string |
||
29 | */ |
||
30 | 11 | public static function getProviderGuard($provider) |
|
35 | } |
||
36 | } |
||
37 | 1 | } |
|
38 | |||
39 | /** |
||
40 | * Get the user guard on provider with `passport` driver. |
||
41 | * |
||
42 | * @param Authenticatable $user |
||
43 | * @return string|null |
||
44 | */ |
||
45 | 9 | public static function getUserGuard(Authenticatable $user) |
|
50 | } |
||
51 | } |
||
52 |