1 | <?php namespace Arcanedev\LaravelTracker\Detectors; |
||
12 | class UserDetector implements UserDetectorContract |
||
13 | { |
||
14 | /* ------------------------------------------------------------------------------------------------ |
||
15 | | Properties |
||
16 | | ------------------------------------------------------------------------------------------------ |
||
17 | */ |
||
18 | /** @var \Illuminate\Contracts\Foundation\Application */ |
||
19 | private $app; |
||
20 | |||
21 | /** @var array */ |
||
22 | private $auths = []; |
||
23 | |||
24 | /* ------------------------------------------------------------------------------------------------ |
||
25 | | Constructor |
||
26 | | ------------------------------------------------------------------------------------------------ |
||
27 | */ |
||
28 | /** |
||
29 | * UserDetector constructor. |
||
30 | * |
||
31 | * @param \Illuminate\Contracts\Foundation\Application $app |
||
32 | */ |
||
33 | public function __construct(Application $app) |
||
39 | |||
40 | /* ------------------------------------------------------------------------------------------------ |
||
41 | | Getters & Setters |
||
42 | | ------------------------------------------------------------------------------------------------ |
||
43 | */ |
||
44 | /** |
||
45 | * Get the config instance. |
||
46 | * |
||
47 | * @return \Illuminate\Contracts\Config\Repository |
||
48 | */ |
||
49 | private function config() |
||
53 | |||
54 | /** |
||
55 | * Get the tracker config. |
||
56 | * |
||
57 | * @param string $key |
||
58 | * @param mixed|null $default |
||
59 | * |
||
60 | * @return mixed |
||
61 | */ |
||
62 | protected function getConfig($key, $default = null) |
||
66 | |||
67 | /* ------------------------------------------------------------------------------------------------ |
||
68 | | Main Functions |
||
69 | | ------------------------------------------------------------------------------------------------ |
||
70 | */ |
||
71 | /** |
||
72 | * Check if the user is authenticated. |
||
73 | * |
||
74 | * @return bool |
||
75 | */ |
||
76 | public function check() |
||
80 | |||
81 | /** |
||
82 | * Get the authenticated user. |
||
83 | * |
||
84 | * @return false|mixed |
||
85 | */ |
||
86 | public function user() |
||
90 | |||
91 | /** |
||
92 | * Get the current authenticated user id. |
||
93 | * |
||
94 | * @return int|null |
||
95 | */ |
||
96 | public function getCurrentUserId() |
||
102 | |||
103 | /* ------------------------------------------------------------------------------------------------ |
||
104 | | Other Functions |
||
105 | | ------------------------------------------------------------------------------------------------ |
||
106 | */ |
||
107 | /** |
||
108 | * Grab all the authentication bindings. |
||
109 | */ |
||
110 | private function instantiateAuthentication() |
||
116 | |||
117 | /** |
||
118 | * Execute the auth method. |
||
119 | * |
||
120 | * @param string $method |
||
121 | * |
||
122 | * @return mixed|false |
||
123 | */ |
||
124 | private function executeAuthMethod($method) |
||
134 | } |
||
135 |