1 | <?php |
||
23 | class TokenGuard implements Guard |
||
24 | { |
||
25 | use GuardHelpers; |
||
26 | |||
27 | /** |
||
28 | * The request instance. |
||
29 | * |
||
30 | * @var \Illuminate\Http\Request |
||
31 | */ |
||
32 | protected $request; |
||
33 | |||
34 | /** |
||
35 | * The name of the query string item from the request containing the API token. |
||
36 | * |
||
37 | * @var string |
||
38 | */ |
||
39 | protected $inputKey; |
||
40 | |||
41 | /** |
||
42 | * The name of the token "column" in persistent storage. |
||
43 | * |
||
44 | * @var string |
||
45 | */ |
||
46 | protected $storageKey; |
||
47 | |||
48 | /** |
||
49 | * Create a new authentication guard. |
||
50 | * |
||
51 | * @param \Rinvex\Fort\Contracts\UserRepositoryContract $provider |
||
52 | * @param \Illuminate\Http\Request $request |
||
53 | * @return void |
||
|
|||
54 | */ |
||
55 | public function __construct(UserRepositoryContract $provider, Request $request) |
||
62 | |||
63 | /** |
||
64 | * Get the currently authenticated user. |
||
65 | * |
||
66 | * @return \Illuminate\Contracts\Auth\Authenticatable|null |
||
67 | */ |
||
68 | public function user() |
||
89 | |||
90 | /** |
||
91 | * Get the token for the current request. |
||
92 | * |
||
93 | * @return string |
||
94 | */ |
||
95 | public function getTokenForRequest() |
||
113 | |||
114 | /** |
||
115 | * Validate a user's credentials. |
||
116 | * |
||
117 | * @param array $credentials |
||
118 | * @return bool |
||
119 | */ |
||
120 | public function validate(array $credentials = []) |
||
134 | |||
135 | /** |
||
136 | * Set the current request instance. |
||
137 | * |
||
138 | * @param \Illuminate\Http\Request $request |
||
139 | * @return $this |
||
140 | */ |
||
141 | public function setRequest(Request $request) |
||
147 | } |
||
148 |
Adding a
@return
annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.