1 | <?php namespace Arcanedev\LaravelTracker\Trackers; |
||
9 | class UserTracker |
||
10 | { |
||
11 | /* ------------------------------------------------------------------------------------------------ |
||
12 | | Properties |
||
13 | | ------------------------------------------------------------------------------------------------ |
||
14 | */ |
||
15 | /** @var \Illuminate\Contracts\Foundation\Application */ |
||
16 | private $app; |
||
17 | |||
18 | /** @var array */ |
||
19 | private $auths = []; |
||
20 | |||
21 | /* ------------------------------------------------------------------------------------------------ |
||
22 | | Constructor |
||
23 | | ------------------------------------------------------------------------------------------------ |
||
24 | */ |
||
25 | /** |
||
26 | * UserTracker constructor. |
||
27 | */ |
||
28 | 6 | public function __construct() |
|
34 | |||
35 | /* ------------------------------------------------------------------------------------------------ |
||
36 | | Getters & Setters |
||
37 | | ------------------------------------------------------------------------------------------------ |
||
38 | */ |
||
39 | /** |
||
40 | * Get the config instance. |
||
41 | * |
||
42 | * @return \Illuminate\Contracts\Config\Repository |
||
43 | */ |
||
44 | 6 | private function config() |
|
48 | |||
49 | /** |
||
50 | * Get the tracker config. |
||
51 | * |
||
52 | * @param string $key |
||
53 | * @param mixed|null $default |
||
54 | * |
||
55 | * @return mixed |
||
56 | */ |
||
57 | 6 | protected function getConfig($key, $default = null) |
|
61 | |||
62 | /* ------------------------------------------------------------------------------------------------ |
||
63 | | Main Functions |
||
64 | | ------------------------------------------------------------------------------------------------ |
||
65 | */ |
||
66 | /** |
||
67 | * Track the current authenticated user id. |
||
68 | * |
||
69 | * @return int|null |
||
70 | */ |
||
71 | 6 | public function track() |
|
77 | |||
78 | /** |
||
79 | * Check if the user is authenticated. |
||
80 | * |
||
81 | * @return bool |
||
82 | */ |
||
83 | 6 | protected function check() |
|
87 | |||
88 | /** |
||
89 | * Get the authenticated user. |
||
90 | * |
||
91 | * @return false|mixed |
||
92 | */ |
||
93 | protected function user() |
||
97 | |||
98 | /* ------------------------------------------------------------------------------------------------ |
||
99 | | Other Functions |
||
100 | | ------------------------------------------------------------------------------------------------ |
||
101 | */ |
||
102 | /** |
||
103 | * Grab all the authentication bindings. |
||
104 | */ |
||
105 | 6 | private function instantiateAuthentication() |
|
111 | |||
112 | /** |
||
113 | * Execute the auth method. |
||
114 | * |
||
115 | * @param string $method |
||
116 | * |
||
117 | * @return mixed|false |
||
118 | */ |
||
119 | 6 | private function executeAuthMethod($method) |
|
129 | } |
||
130 |